registry icon indicating copy to clipboard operation
registry copied to clipboard

hapijs, expressjs, koa for server end

Open naivefun opened this issue 8 years ago • 17 comments

naivefun avatar Feb 12 '16 00:02 naivefun

Doe you mean https://www.npmjs.com/package/hapi with hapijs ?

Fank avatar Feb 13 '16 10:02 Fank

+1

aliatsis avatar Mar 08 '16 09:03 aliatsis

+1

ghost avatar Mar 29 '16 15:03 ghost

+1 for express

stevehipwell avatar May 13 '16 11:05 stevehipwell

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.

joshwiens avatar May 14 '16 04:05 joshwiens

@d3viant0ne I'd take a look at the express definitions on DT first.

JoshGlazebrook avatar May 20 '16 22:05 JoshGlazebrook

@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.

joshwiens avatar May 20 '16 23:05 joshwiens

@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).

JoshGlazebrook avatar May 20 '16 23:05 JoshGlazebrook

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.

joshwiens avatar May 21 '16 00:05 joshwiens

@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 avatar May 21 '16 02:05 blakeembrey

@blakeembrey I definitely want to add some for some of the more prominent hapi plugins.

buildjosh avatar May 21 '16 02:05 buildjosh

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.

buildjosh avatar May 23 '16 02:05 buildjosh

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?

felixfbecker avatar Aug 09 '16 23:08 felixfbecker

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?

unional avatar Aug 10 '16 00:08 unional

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 :)

felixfbecker avatar Aug 10 '16 01:08 felixfbecker

And here is body-parser https://github.com/felixfbecker/typed-body-parser

felixfbecker avatar Aug 10 '16 01:08 felixfbecker

@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 😄

blakeembrey avatar Aug 10 '16 05:08 blakeembrey