Commit e4ad4c42 authored by Johannes Zellner's avatar Johannes Zellner

Fix serving up the root welcome page

parent 4eee848b
...@@ -33,7 +33,12 @@ router.delete('/api/files/*', auth.verify, files.del); ...@@ -33,7 +33,12 @@ router.delete('/api/files/*', auth.verify, files.del);
router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); }); router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); });
// welcome screen in case / does not serve up any file yet // welcome screen in case / does not serve up any file yet
router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html')); }); function welcomePage(req, res, next) {
if (req.path !== '/') return next();
res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html'));
}
// router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html')); });
var rootFolder = path.resolve(__dirname, process.argv[2] || 'files'); var rootFolder = path.resolve(__dirname, process.argv[2] || 'files');
...@@ -48,6 +53,7 @@ app.use('/api', passport.session()); ...@@ -48,6 +53,7 @@ app.use('/api', passport.session());
app.use(router); app.use(router);
app.use('/_admin', express.static(__dirname + '/frontend')); app.use('/_admin', express.static(__dirname + '/frontend'));
app.use('/', express.static(rootFolder)); app.use('/', express.static(rootFolder));
app.use('/', welcomePage);
app.use('/', serveIndex(rootFolder, { icons: true })); app.use('/', serveIndex(rootFolder, { icons: true }));
app.use(lastMile()); app.use(lastMile());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment