creationix / stack

Stack is a minimal http module system for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

connect ?

weepy opened this issue · comments

is connect going to be rewritten using stack ?

Not that I know of. I know TJ is planning to rewrite or heavily refactor connect, but I don't think he wants to base it on stack. Also, by design stack will never come bundled with middleware like connect does.

ah - i see - out of interest - how would u need to change Stack to make it more Connect ready? From my far off view, it sounded like a perfect fit :-)

It's meant to be a near drop-in replacement for the core connect dispatcher. The middleware format is the same. You can use connect middlewares with stack and my creationix middlewares can be used with connect.

There are some slightly different semantics with regard to error handling. Connect routes errors to the first middleware that has the proper signature. In stack, it's an explicit error handling function that's attached to the stack function.

So does that mean that a Connect v2 couldn't quite work with Stack as it is, and equally Stack couldn't be easily modified (in a sane way) to support that same Connect functionality (matching sigs) ?

It's not a big deal. Most apps never have more than one error handler and it's app specific. Stack and Connect already have different external APIs, Stack returns a handler function where Connect is a subclass of HTTP.Server. The interop is that all normal middleware can be used with either.