pillarjs / discussions

http://pillarjs.github.io
7 stars 0 forks source link

Moving Request and Response into separate modules #13

Open wesleytodd opened 8 years ago

wesleytodd commented 8 years ago

Started with some conversation here: https://github.com/pillarjs/router/issues/14#issuecomment-175304815

Express, Sails and Nighthawk are all doing something similar, creating instances of Request and Response to pass to the router. Currently Express extends directly from http.IncomingResponse which doesn't work for the context of WS requests or browser routing.

The discussion I would like to have here is "How can we create stand-alone modules that can be used for all three use cases?".

cc: @mikermcneil @felixfbecker

wesleytodd commented 8 years ago

Relevant code

Express: https://github.com/strongloop/express/blob/5.0/lib/request.js https://github.com/strongloop/express/blob/5.0/lib/response.js https://github.com/strongloop/express/blob/5.0/lib/application.js#L159-L164

Sails: https://github.com/balderdashy/sails/blob/master/lib/router/index.js#L168 https://github.com/balderdashy/sails/blob/master/lib/router/req.js https://github.com/balderdashy/sails/blob/master/lib/app/request.js#L138

Nighthawk: https://github.com/wesleytodd/nighthawk/blob/master/lib/request.js https://github.com/wesleytodd/nighthawk/blob/master/lib/response.js https://github.com/wesleytodd/nighthawk/blob/master/lib/router.js#L187-L198