New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best practice for Express middle-ware and other things #313
Comments
Ah I can see how that is confusing, However, even with the REST API provider configured, passing a service object to Although Feathers is fully compatible with Express and its middleware, services have a major advantage though: They are protocol independent and also work via websockets and possibly other protocols in the future. You can also use them on the client. In the Philosophy section we outlined the reasons why we think that is important and the Feathers + Express & Socket.io discusses a little more how both play together. To answer the question which to use when: Use Services and hooks whenever possible. You can still use Express middleware for the parts of the app that are used via a HTTP REST API but unlike services, Express middleware does not work with websockets. |
That helped @daffl , Thanks. One last thing, for now.
Feathers uses Express compatible middle-ware. But the docs show examples using promises, something non Express standard. Why? Express uses res.send, res.render or just next() in the case of middleware |
You can use the legacy callback in services and hooks support a legacy Lastly, everything you mentioned is very Express specific. While Feathers currently only works with Express on the server there are plans to also make it more decoupled and compatible with other server frameworks like Koa and Hapi (see #258). |
Closing this one as well. Hope that answered all your questions. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs. |
I am slightly confused, please bear with me.
Taken from a scaffolded app
or, from the docs....
Thanks
The text was updated successfully, but these errors were encountered: