{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/express/issues/2573","labels_url":"https://api.github.com/repos/strongloop/express/issues/2573/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/express/issues/2573/comments","events_url":"https://api.github.com/repos/strongloop/express/issues/2573/events","html_url":"https://github.com/strongloop/express/issues/2573","id":59418713,"number":2573,"title":"Documentation for middleware parameter count","user":{"login":"joepie91","id":1663259,"avatar_url":"https://avatars.githubusercontent.com/u/1663259?v=3","gravatar_id":"","url":"https://api.github.com/users/joepie91","html_url":"https://github.com/joepie91","followers_url":"https://api.github.com/users/joepie91/followers","following_url":"https://api.github.com/users/joepie91/following{/other_user}","gists_url":"https://api.github.com/users/joepie91/gists{/gist_id}","starred_url":"https://api.github.com/users/joepie91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joepie91/subscriptions","organizations_url":"https://api.github.com/users/joepie91/orgs","repos_url":"https://api.github.com/users/joepie91/repos","events_url":"https://api.github.com/users/joepie91/events{/privacy}","received_events_url":"https://api.github.com/users/joepie91/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/strongloop/express/labels/docs","name":"docs","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars.githubusercontent.com/u/67512?v=3","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-03-01T21:34:38Z","updated_at":"2015-03-01T21:36:55Z","closed_at":"2015-03-01T21:36:55Z","body":"In the past few days, I've seen two instances of #Node.js IRC users running into trouble with middleware parameters, where the parameters would not contain the expected data.\r\n\r\nIn both cases, the issue was a piece of middleware with the signature `(err, req, res)`. Due to the parameter count, Express seemingly assumes that the signature is `(req, res, next)` and thus treats the middleware as regular middleware. It is evidently not obvious to users that the middleware type is determined by the parameter count, and that they cannot simply omit the `next` parameter for error handling middleware.\r\n\r\nI'm not sure of the specific place it would fit in, but this should probably be in the documentation somewhere, to keep people from running into this trap :)"},"comment":{"url":"https://api.github.com/repos/strongloop/express/issues/comments/76632365","html_url":"https://github.com/strongloop/express/issues/2573#issuecomment-76632365","issue_url":"https://api.github.com/repos/strongloop/express/issues/2573","id":76632365,"user":{"login":"dougwilson","id":67512,"avatar_url":"https://avatars.githubusercontent.com/u/67512?v=3","gravatar_id":"","url":"https://api.github.com/users/dougwilson","html_url":"https://github.com/dougwilson","followers_url":"https://api.github.com/users/dougwilson/followers","following_url":"https://api.github.com/users/dougwilson/following{/other_user}","gists_url":"https://api.github.com/users/dougwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/dougwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougwilson/subscriptions","organizations_url":"https://api.github.com/users/dougwilson/orgs","repos_url":"https://api.github.com/users/dougwilson/repos","events_url":"https://api.github.com/users/dougwilson/events{/privacy}","received_events_url":"https://api.github.com/users/dougwilson/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T21:36:55Z","updated_at":"2015-03-01T21:36:55Z","body":"I agree. So the place to file this would be over at https://github.com/strongloop/expressjs.com :)\r\n\r\nCurrently the only docs we have on this is http://expressjs.com/guide/error-handling.html"}}