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
and it uses both this code and serveStatic but that means it's hard coded to serve static, and a certain version and you have a dependency that needs to be updated etc.
Wouldn't be just as easy yet more flexible to just call next and if I want static files I could do
Thanks for your feedback.
I acutally did not think about splitting serveStatic from expressStaticGzip before. I could definetly see this as a separate usecase, where you just want to alter the request path and do not want to actually serve a file - so definitely not a dumb question!
But for the scenario where expressStaticGzip is designed for, the serveStatic functionality is required, as i did not want to implement anything that is already implemented by serveStatic. ExpressStaticGzip's purpose is to serve previously compressed files, that lie in some folder. It was initially designed to work standalone, so this is the reason I used serveStatic as a dependency to handle the file serving.
I did some additions to forward options to serveStatic, for people that have other files next to the compressed files or did want to alter caching behaviour of the served files.
I can agree, that there might be cases, where you have a more complex setup and want more control over serveStatic, but i guess, this needs to be handled during the setup of routing, and can not be solved by expressStaticGzip just not serving files.
Sorry if this is a dumb question but have you thought about removing the serveStatic part?
As it is I call something like
app.use("/", expressStaticGzip("/my/rootFolder/"));
and it uses both this code and serveStatic but that means it's hard coded to serve static, and a certain version and you have a dependency that needs to be updated etc.
Wouldn't be just as easy yet more flexible to just call next and if I want static files I could do
app.use("/", expressStaticGzip("/my/rootFolder/"));
app.use("/", express.static("/", staticOptions));
And then I could use other things as well?
The text was updated successfully, but these errors were encountered: