You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case to unmount a middleware function: I'm exposing an express server with a dynamic collection of ApolloServers. Once the data has expired, I want to unmount it.
The current way I'm accomplishing this is by splicing app._router.stack. This feels like an unsupported method which may break in any future express version.
What is the recommended approach here? Could we request a supported way to unmount a middleware function?
The text was updated successfully, but these errors were encountered:
There is no safe way to unmount a middleware since it will corrupted concurrent requests routing through the system. The method is really just to swap out one router for another router. If you can provide more details on exactly what you are trying to do, we can help you with a solution.
Mounting a middleware function is documented here: https://expressjs.com/en/5x/api.html#app.use
I have a use case to unmount a middleware function: I'm exposing an express server with a dynamic collection of ApolloServers. Once the data has expired, I want to unmount it.
The current way I'm accomplishing this is by splicing
app._router.stack
. This feels like an unsupported method which may break in any future express version.What is the recommended approach here? Could we request a supported way to unmount a middleware function?
The text was updated successfully, but these errors were encountered: