Support files other than index.html at server root

pull/1/head
ansuz 8 years ago
parent 7eaa4ce733
commit eb797aa7cd

@ -43,9 +43,10 @@ var handleFile = function (target, res, fallback, next) {
app.use("/customize", Express.static(__dirname + '/customize')); app.use("/customize", Express.static(__dirname + '/customize'));
app.use("/customize", Express.static(__dirname + '/customize.dist')); app.use("/customize", Express.static(__dirname + '/customize.dist'));
app.use(/^\/$/, function(req, res, next) { app.use(/^\/[^\/]*$/, function(req, res, next) {
handleFile(__dirname + '/customize/index.html', // try piping this file first var file = req.originalUrl.slice(1) || 'index.html';
res, __dirname + '/customize.dist/index.html', // if it doesn't exist handleFile(__dirname + '/customize' + file, // try piping this file first
res, __dirname + '/customize.dist/' + file, // if it doesn't exist
next); // finally, fall through next); // finally, fall through
}); });

Loading…
Cancel
Save