From eb797aa7cddde548e5304e9ab25f83fa37b248c4 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 16 Aug 2016 17:28:49 +0200 Subject: [PATCH] Support files other than index.html at server root --- server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index b67b6d28a..f9817b180 100644 --- a/server.js +++ b/server.js @@ -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.dist')); -app.use(/^\/$/, function(req, res, next) { - handleFile(__dirname + '/customize/index.html', // try piping this file first - res, __dirname + '/customize.dist/index.html', // if it doesn't exist +app.use(/^\/[^\/]*$/, function(req, res, next) { + var file = req.originalUrl.slice(1) || 'index.html'; + handleFile(__dirname + '/customize' + file, // try piping this file first + res, __dirname + '/customize.dist/' + file, // if it doesn't exist next); // finally, fall through });