{"action":"created","issue":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/189","labels_url":"https://api.github.com/repos/feathersjs/feathers/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/feathersjs/feathers/issues/189/comments","events_url":"https://api.github.com/repos/feathersjs/feathers/issues/189/events","html_url":"https://github.com/feathersjs/feathers/issues/189","id":124872905,"number":189,"title":"Thoughts on cleaning up the .use syntax.","user":{"login":"marshallswain","id":128857,"avatar_url":"https://avatars.githubusercontent.com/u/128857?v=3","gravatar_id":"","url":"https://api.github.com/users/marshallswain","html_url":"https://github.com/marshallswain","followers_url":"https://api.github.com/users/marshallswain/followers","following_url":"https://api.github.com/users/marshallswain/following{/other_user}","gists_url":"https://api.github.com/users/marshallswain/gists{/gist_id}","starred_url":"https://api.github.com/users/marshallswain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marshallswain/subscriptions","organizations_url":"https://api.github.com/users/marshallswain/orgs","repos_url":"https://api.github.com/users/marshallswain/repos","events_url":"https://api.github.com/users/marshallswain/events{/privacy}","received_events_url":"https://api.github.com/users/marshallswain/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-05T01:01:07Z","updated_at":"2016-01-05T01:12:50Z","closed_at":null,"body":"I'm not sure if that's the proper title, but here are the goals I'm trying to accomplish here:\r\n - Standardize the service configuration and hooks into a single file or single point of entry.  (I think this will make it easier to create a drag-and-drop Feathers server builder UI in the future.)\r\n - Keep the index.js / server.js free of db connection logic , if so desired.  This makes sense to be since the services are the only ones to be using it.\r\n - Keep the service path in the same file with the server setup (`.use('path/to/service, serviceSetup)`), but everything else to do with a service goes into the service's own file or file/folder structure.\r\n\r\nBasically, it would be nice to be able to do something like the following pseudo example.\r\n\r\n```js\r\n// index.js\r\nimport todoService from 'services/todos';\r\nimport feathers from 'feathers';\r\nlet app = feathers();\r\napp.use('todos', todoService);\r\n```\r\n\r\n```js\r\n// services/todos.js\r\nexport default function(app){\r\n  /* * * Do any connection stuff here, if needed * * */\r\n\r\n  /* * * Service Type * * */\r\n  this.type = mongooseService({Model: MongooseModel});\r\n\r\n  /* * * Before hooks * * */\r\n  this.before({\r\n    all:   [hooks.requireAuthForPrivate()],\r\n    before: [hooks.setUserID()]\r\n  });\r\n\r\n  /* * * After hooks * * */\r\n  this.after({\r\n    all: [hooks.removeSomeField()]\r\n  });\r\n\r\n  /* * * Set up event filters * * */\r\n  this.created = this.updated = this.patched = this.removed = events.requireAuthForPrivate;\r\n\r\n  return this;\r\n}\r\n```\r\n\r\nI thought at first that we could simply modify `.use()` to work similar to how `.configure()` works with passing in the `app` as the context, but this doesn't address how we would keep `.use('path/to/service', serviceSetup)` in with the main server config.\r\n\r\nWhat are your thoughts on making this possible?"},"comment":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/comments/168861407","html_url":"https://github.com/feathersjs/feathers/issues/189#issuecomment-168861407","issue_url":"https://api.github.com/repos/feathersjs/feathers/issues/189","id":168861407,"user":{"login":"ahdinosaur","id":719605,"avatar_url":"https://avatars.githubusercontent.com/u/719605?v=3","gravatar_id":"","url":"https://api.github.com/users/ahdinosaur","html_url":"https://github.com/ahdinosaur","followers_url":"https://api.github.com/users/ahdinosaur/followers","following_url":"https://api.github.com/users/ahdinosaur/following{/other_user}","gists_url":"https://api.github.com/users/ahdinosaur/gists{/gist_id}","starred_url":"https://api.github.com/users/ahdinosaur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahdinosaur/subscriptions","organizations_url":"https://api.github.com/users/ahdinosaur/orgs","repos_url":"https://api.github.com/users/ahdinosaur/repos","events_url":"https://api.github.com/users/ahdinosaur/events{/privacy}","received_events_url":"https://api.github.com/users/ahdinosaur/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T01:12:50Z","updated_at":"2016-01-05T01:12:50Z","body":"> Standardize the service configuration and hooks into a single file or single point of entry.\r\n\r\n:+1:\r\n\r\ni was wondering what's the cleanest way to integrate my [`feathers-tcomb`](https://github.com/ahdinosaur/feathers-tcomb) hooks within a service definition. then all the ES6 changes lead me to thinking about feathers services as [composable stamps](https://github.com/stampit-org/stampit), which would be exciting."}}