{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/express/issues/2870","labels_url":"https://api.github.com/repos/strongloop/express/issues/2870/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/express/issues/2870/comments","events_url":"https://api.github.com/repos/strongloop/express/issues/2870/events","html_url":"https://github.com/strongloop/express/issues/2870","id":129790196,"number":2870,"title":"Writing a generic middleware framework based on Express","user":{"login":"elliothatch","id":2262577,"avatar_url":"https://avatars.githubusercontent.com/u/2262577?v=3","gravatar_id":"","url":"https://api.github.com/users/elliothatch","html_url":"https://github.com/elliothatch","followers_url":"https://api.github.com/users/elliothatch/followers","following_url":"https://api.github.com/users/elliothatch/following{/other_user}","gists_url":"https://api.github.com/users/elliothatch/gists{/gist_id}","starred_url":"https://api.github.com/users/elliothatch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elliothatch/subscriptions","organizations_url":"https://api.github.com/users/elliothatch/orgs","repos_url":"https://api.github.com/users/elliothatch/repos","events_url":"https://api.github.com/users/elliothatch/events{/privacy}","received_events_url":"https://api.github.com/users/elliothatch/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-29T15:02:24Z","updated_at":"2016-01-29T22:41:14Z","closed_at":"2016-01-29T22:28:31Z","body":"I apologize in advance if this isn't the right place to ask this question.\r\n\r\nI've been working with Socket.IO for a short time and have found myself using a transactional model for many of my socket operations. Currently, these transactions are just coded into event handlers, but I'd really like a middleware based routing pipeline, so I began designing a Socket.IO middleware framework, modeled after Express.\r\n\r\nAfter looking at the Express code for a bit I noticed that the majority of HTTP specific code is isolated in the request and response objects and thought, hey, instead of writing a framework just for Socket.IO, how about writing a generic middleware framework that abstracts away the request and response into an interface? Then the user can write a concrete version of request and response for any transactional model they want, for any protocol or library they want--be it various HTTP backends, socket transactions, database queries, etc.\r\n\r\nSo my question is: would it be feasible to build this kind of framework off of Express? From what I've seen, the HTTP code seems mostly isolated from the framework code, so it would be a simple matter of abstracting out requests and responses, and cleaning up a few parts of the code that make assumptions about req and res. Or, as an HTTP framework, does Express make deeper assumptions than I realize, and trying to adapt its codebase would end up causing me more trouble than if I just rolled my own framework?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/strongloop/express/issues/comments/177002682","html_url":"https://github.com/strongloop/express/issues/2870#issuecomment-177002682","issue_url":"https://api.github.com/repos/strongloop/express/issues/2870","id":177002682,"user":{"login":"elliothatch","id":2262577,"avatar_url":"https://avatars.githubusercontent.com/u/2262577?v=3","gravatar_id":"","url":"https://api.github.com/users/elliothatch","html_url":"https://github.com/elliothatch","followers_url":"https://api.github.com/users/elliothatch/followers","following_url":"https://api.github.com/users/elliothatch/following{/other_user}","gists_url":"https://api.github.com/users/elliothatch/gists{/gist_id}","starred_url":"https://api.github.com/users/elliothatch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elliothatch/subscriptions","organizations_url":"https://api.github.com/users/elliothatch/orgs","repos_url":"https://api.github.com/users/elliothatch/repos","events_url":"https://api.github.com/users/elliothatch/events{/privacy}","received_events_url":"https://api.github.com/users/elliothatch/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T22:41:14Z","updated_at":"2016-01-29T22:41:14Z","body":"@ChiperSoft Oh, I've been looking at the master branch this entire time. I'll definitely look into that, thanks!"}}