{"action":"opened","issue":{"url":"https://api.github.com/repos/balderdashy/sails/issues/2603","labels_url":"https://api.github.com/repos/balderdashy/sails/issues/2603/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/sails/issues/2603/comments","events_url":"https://api.github.com/repos/balderdashy/sails/issues/2603/events","html_url":"https://github.com/balderdashy/sails/issues/2603","id":56172382,"number":2603,"title":"Better custom middleware?","user":{"login":"slavafomin","id":1702725,"avatar_url":"https://avatars.githubusercontent.com/u/1702725?v=3","gravatar_id":"","url":"https://api.github.com/users/slavafomin","html_url":"https://github.com/slavafomin","followers_url":"https://api.github.com/users/slavafomin/followers","following_url":"https://api.github.com/users/slavafomin/following{/other_user}","gists_url":"https://api.github.com/users/slavafomin/gists{/gist_id}","starred_url":"https://api.github.com/users/slavafomin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slavafomin/subscriptions","organizations_url":"https://api.github.com/users/slavafomin/orgs","repos_url":"https://api.github.com/users/slavafomin/repos","events_url":"https://api.github.com/users/slavafomin/events{/privacy}","received_events_url":"https://api.github.com/users/slavafomin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-01T18:27:41Z","updated_at":"2015-02-01T18:27:41Z","closed_at":null,"body":"Hello!\r\n\r\nAccording [to the docs] (http://sailsjs.org/#/documentation/concepts/Middleware), custom middleware should be defined inside of a «**config/http.js**» file. There is no built-in or otherwise conventional way to define middleware in a separate files (correct me if I'm wrong please). I think this is a major drawback, cause business-logic should not be contained in the *config* directory.\r\n\r\nThe better approach will be to store custom middleware inside of the project in the «middleware» directory. Such middleware files can be autoloaded exactly like controllers are. The name of the middleware will be defined by the name of the file without extension.\r\n\r\nDoes it makes sense? Thank you!"}}