registry
registry copied to clipboard
hapijs, expressjs, koa for server end
Doe you mean https://www.npmjs.com/package/hapi with hapijs ?
+1
+1
+1 for express
So as I write my APIs in TypeScript and I'm tired of the sad state of back end type definitions, I'm picking this one up.
Starting with what I need now which is Express and moving to what I will need soon which is Hapi.
@d3viant0ne I'd take a look at the express definitions on DT first.
@JoshGlazebrook I have, they aren't written to work with Typings and are 13 minor versions out of date. A problem I am tired of contending with.
@d3viant0ne Yea I've noticed that too. I was thinking as more of a starting point so you don't have to do it all from scratch (if you don't want to).
Oh, yeah. I have no intention of writing all of that from scratch though I do have to go through and verify all of it.
I'm going to do the work here - https://github.com/DeviantJS/npm-express
I should have time to dig into express this weekend.
@blakeembrey Once I have this finished, if you / the Typed Typings crew want the repo with the rest of the official ones, i'll transfer it over.
@d3viant0ne Do you have/want access to Typed Typings? I'd be happy to add you and you can create whichever repos you want for this (and add others here that are interested).
@blakeembrey I definitely want to add some for some of the more prominent hapi plugins.
Damn, @blakeembrey I meant to post that ^ from @JoshGlazebrook (this @buildjosh is my work github account). I guess it doesn't help that I just look at all inboxes on my phone.
I have https://github.com/felixfbecker/typed-express and https://github.com/felixfbecker/typed-serve-static finished but I am struggling with the cyclic dependency between them. express exports serve-static under express.static
, but serve-static has some functions that need the interfaces from express (specifically, the Request
interface). How can this be solved with typings?
serve-static
does not depends on express
:
https://github.com/expressjs/serve-static/blob/master/package.json#L9-L12
Does it mean Request
comes from one of those?
Or Request
is originated form serve-static
and express
should get that form it?
But the typings depend on it, thats the problem. The typings from DefinitelyTyped referenced the ~~Request
~~Response
interface. Which technically is not even 100% correct, because serve-static can also be used with a vanilla node server, in which case res
will just be a http.ServerResponse
object. I managed to replace all references and added extra tests to ensure that everything can still be used with express.
DefinitelyTyped solved this by introducing a virtual express-serve-static-core typing, which I want to avoid at all cost :)
And here is body-parser https://github.com/felixfbecker/typed-body-parser
@felixfbecker You should be able to write it depending on raw http. Better yet, with this sort of thing you can actually just type the minimum interface that is required and if http.Request
or express.Request
satisfies it you're in business 😄