creationix / stack

Stack is a minimal http module system for node.js
MIT License
103 stars 10 forks source link

connect ? #1

Open weepy opened 13 years ago

weepy commented 13 years ago

is connect going to be rewritten using stack ?

creationix commented 13 years ago

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.

weepy commented 13 years ago

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

creationix commented 13 years ago

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.

weepy commented 13 years ago

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

creationix commented 13 years ago

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.