PR #2255 adds an asyncronous app.setup and service.setup which can be used with new hooks. However, when working with @marshallswain we noticed that this is still not ideal when configuring your application. For example the MongoDB service needs the asynchronous model in the configure function before its setup method is called. We are now looking at adding the following improvements:
app.configure should allow async functions. They will run in the order app.configure is called and only when the previous function returns. If there is any asynchronous app.configure function, await app.setup() or app.listen() must be called before any services (calling app.service(name)) can be used.
- As an additional improvement and to avoid having the app in an unexpected state (e.g. in tests), if any service implements a
setup method, await app.setup() or app.listen() must also be called before any services (calling app.service(name)) can be used.
Both changes will work compatible with existing applications, specifically we wanted to avoid having to unnecessarily call app.setup on client side Feathers apps.
Related to #509 and #853
PR #2255 adds an asyncronous
app.setupandservice.setupwhich can be used with new hooks. However, when working with @marshallswain we noticed that this is still not ideal when configuring your application. For example the MongoDB service needs the asynchronous model in theconfigurefunction before itssetupmethod is called. We are now looking at adding the following improvements:app.configureshould allowasyncfunctions. They will run in the orderapp.configureis called and only when the previous function returns. If there is any asynchronousapp.configurefunction,await app.setup()orapp.listen()must be called before any services (callingapp.service(name)) can be used.setupmethod,await app.setup()orapp.listen()must also be called before any services (callingapp.service(name)) can be used.Both changes will work compatible with existing applications, specifically we wanted to avoid having to unnecessarily call
app.setupon client side Feathers apps.Related to #509 and #853