I would like to serve static assets for paths that begin with an cache buster:
Does Express support this?
I attempted to create a custom middleware that
but this doesn't seem to work. It appears Express.static doesn't inspect req.path directly.
What's the best way to achieve this? Any help would be appreciated. Thanks.
If I understand correctly you want to filter express middleware based on the url? Mostly when you need that you wrap the middleware.
function (req, res, next) {
if (req.url === 'something') {
return express.static(__dirname + '/public')(req, res, next);
}
next();
}