Closed leemhenson closed 6 years ago
Hi!
What do you think about supporting multiple server libs?
It would be really nice, let me read the code carefully and then I'll post some comments
@leemhenson This is awesome. Basically, excluding the router, you can migrate from express to koa (or the other way around) just by swapping the toRequestHandler
function, right?
I was thinking.. MiddlewareTask.toRequestHandler
looks useless now that we have a toRequestHandler
function is each adapter, and it just calls eval
on the middleware, what if we get rid of it?
Oh wait, expanding on toRequestHandler
there's a problem: each adapter has a hard dependency on MiddlewareTask
, we should try to remove it (you are free to write your interpreter, for example one that uses bluebird or funfix's Future under the hood instead of Promise)
expanding on toRequestHandler there's a problem
@leemhenson I propose to
toRequestHandler
from MiddlewareTask
and from each adapterMiddlewareMonad
and a specific target (express or koa)I've made those changes. I agree with the toRequestHandler changes, it was just a load of indirection for no real gain.
@leemhenson Thanks! Last thing before merging, could you please move the examples out of src
? Perhaps a top level folder examples
?
I've tidied up a smidge more.
@leemhenson Released in the next
channel if you want to try it out
npm i hyper-ts@next # v0.2.0-dev.20180126
Hi Giulio
What do you think about supporting multiple server libs? We use http://koajs.com/ rather than express, but their apis are very similar. I've done a simple split via
Conn
,ExpressConn
andKoaConn
. The tests all pass but I haven't actually run it in anger yet. I wanted to post it up here to get any feedback you might have.