diff options
author | Johannes Zellner <johannes@cloudron.io> | 2017-02-09 16:23:23 +0100 |
---|---|---|
committer | Johannes Zellner <johannes@cloudron.io> | 2017-02-09 16:23:23 +0100 |
commit | e4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96 (patch) | |
tree | c51e5b03961d9ae846a01ebaa1733a6d233729dc | |
parent | 4eee848b4980beddbf5a66d045f2a2ad2fb31c02 (diff) | |
download | Surfer-e4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96.tar.gz Surfer-e4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96.tar.zst Surfer-e4ad4c422b58f9c7c9c4e36a6e8942d7a1901e96.zip |
Fix serving up the root welcome page
-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 | ||