Adding support for a prefix function in options to dynamically prefixing the paths. This could be usefull to serve different subfolders statically depeneding on the user-agent or other parts of the request.
For example:
var express = require('express')
var serveStatic = require('serve-static')
var app = express()
app.use(serveStatic( resolvePath( '/build', {
prefix: serveByUserAgent
}));
app.listen(3000)
function serveByUserAgent(req) {
var userAgent = req.get('user-agent');
// test user-agent for 'Internet Explorer'
if ((userAgent.match(/(MSIE)/i) || userAgent.match(/(Trident)/i)) && !userAgent.match(/(Edge)/i)) {
return '/compiled'
}
return '/bundled';
}
Adding support for a prefix function in options to dynamically prefixing the paths. This could be usefull to serve different subfolders statically depeneding on the user-agent or other parts of the request. For example: