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'd like to add just a single middleware (modrewrite) to existing ones and configure serving static files via base option. However, providing middleware option overwrites the default middleware stack.
It would be great if there was a way to just add new middlewares to the stack.
It possibly could be done by providing the default stack (one returned by the default middleware function) that would be passed to custom middleware function as a third argument:
This is interesting and I can see how it could be convenient but configuring your own middleware along with replicating the existing, is convenient enough, imo. The default middleware only looks complex to accommodate all the options thrown at it but when customizing middleware, it doesn't need to be. For example if you want modrewrite, static and directory it would be:
Yeah, you're right. My specific use case was to modify grunt configuration generated by angular generator to support HTML5 history API. The generator creates a config with base option as an array of paths and to add modrewrite middleware to the stack I need to replace them with connect.static('...'). Being able to add it before an existing stack would require a few less changes.
I'd like to add just a single middleware (modrewrite) to existing ones and configure serving static files via
base
option. However, providingmiddleware
option overwrites the default middleware stack.It would be great if there was a way to just add new middlewares to the stack.
It possibly could be done by providing the default stack (one returned by the default
middleware
function) that would be passed to custommiddleware
function as a third argument:I'm not sure if this is going to work, but at least in theory it should allow to add a new middleware to an existing stack:
One could also overwrite the default stack by simply returning a new stack from
middleware
function (the current behavior) e.g.:The text was updated successfully, but these errors were encountered: