diff options
-rwxr-xr-x | server.js | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -33,7 +33,12 @@ router.delete('/api/files/*', auth.verify, files.del); | |||
33 | router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); }); | 33 | router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); }); |
34 | 34 | ||
35 | // welcome screen in case / does not serve up any file yet | 35 | // welcome screen in case / does not serve up any file yet |
36 | router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html')); }); | 36 | function welcomePage(req, res, next) { |
37 | if (req.path !== '/') return next(); | ||
38 | |||
39 | res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html')); | ||
40 | } | ||
41 | // router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html')); }); | ||
37 | 42 | ||
38 | var rootFolder = path.resolve(__dirname, process.argv[2] || 'files'); | 43 | var rootFolder = path.resolve(__dirname, process.argv[2] || 'files'); |
39 | 44 | ||
@@ -48,6 +53,7 @@ app.use('/api', passport.session()); | |||
48 | app.use(router); | 53 | app.use(router); |
49 | app.use('/_admin', express.static(__dirname + '/frontend')); | 54 | app.use('/_admin', express.static(__dirname + '/frontend')); |
50 | app.use('/', express.static(rootFolder)); | 55 | app.use('/', express.static(rootFolder)); |
56 | app.use('/', welcomePage); | ||
51 | app.use('/', serveIndex(rootFolder, { icons: true })); | 57 | app.use('/', serveIndex(rootFolder, { icons: true })); |
52 | app.use(lastMile()); | 58 | app.use(lastMile()); |
53 | 59 | ||