expressjs / serve-static

Serve static files
MIT License
1.39k stars 228 forks source link

Extra parameter in options, a filter function to allow or deny files to be served #77

Closed arcturus closed 7 years ago

arcturus commented 7 years ago

Found my self with the problem that I want to server a directory, but would love to skip some files.

This pr allows to configure a filter function, that receives the path and the originalUrl variables to allow to make a decision if the file should be served or not.

dougwilson commented 7 years ago

This is a common function people want to do with all middlewares. Just wrap it in your filter, no change necessary here :)