aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@cloudron.io>2017-02-09 16:23:23 +0100
committerJohannes Zellner <johannes@cloudron.io>2017-02-09 16:23:23 +0100
commite4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96 (patch)
treec51e5b03961d9ae846a01ebaa1733a6d233729dc
parent4eee848b4980beddbf5a66d045f2a2ad2fb31c02 (diff)
downloadSurfer-e4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96.tar.gz
Surfer-e4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96.tar.zst
Surfer-e4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96.zip
Fix serving up the root welcome page
-rwxr-xr-xserver.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/server.js b/server.js
index 68fbb9a..5814539 100755
--- a/server.js
+++ b/server.js
@@ -33,7 +33,12 @@ router.delete('/api/files/*', auth.verify, files.del);
33router.get ('/api/healthcheck', function (req, res) { res.status(200).send(); }); 33router.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
36router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/frontend/welcome.html')); }); 36function 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
38var rootFolder = path.resolve(__dirname, process.argv[2] || 'files'); 43var rootFolder = path.resolve(__dirname, process.argv[2] || 'files');
39 44
@@ -48,6 +53,7 @@ app.use('/api', passport.session());
48app.use(router); 53app.use(router);
49app.use('/_admin', express.static(__dirname + '/frontend')); 54app.use('/_admin', express.static(__dirname + '/frontend'));
50app.use('/', express.static(rootFolder)); 55app.use('/', express.static(rootFolder));
56app.use('/', welcomePage);
51app.use('/', serveIndex(rootFolder, { icons: true })); 57app.use('/', serveIndex(rootFolder, { icons: true }));
52app.use(lastMile()); 58app.use(lastMile());
53 59