-
-
Notifications
You must be signed in to change notification settings - Fork 16k
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
Unmounting middleware #4436
Labels
Comments
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: