aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@cloudron.io>2017-02-05 06:08:43 -0800
committerJohannes Zellner <johannes@cloudron.io>2017-02-05 06:08:43 -0800
commit490f71d70fa24042a80175129e8ba7ba12d95c17 (patch)
tree6f3e0292effcfeb2915deffe9a7ead0099b4e046
parentdc7353941f0e61145cd957df3955bc6f2d001cec (diff)
downloadSurfer-490f71d70fa24042a80175129e8ba7ba12d95c17.tar.gz
Surfer-490f71d70fa24042a80175129e8ba7ba12d95c17.tar.zst
Surfer-490f71d70fa24042a80175129e8ba7ba12d95c17.zip
Serve up folder listings
-rwxr-xr-xserver.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/server.js b/server.js
index eaeed17..7577d26 100755
--- a/server.js
+++ b/server.js
@@ -15,6 +15,7 @@ var express = require('express'),
15 multipart = require('./src/multipart'), 15 multipart = require('./src/multipart'),
16 mkdirp = require('mkdirp'), 16 mkdirp = require('mkdirp'),
17 auth = require('./src/auth.js'), 17 auth = require('./src/auth.js'),
18 serveIndex = require('serve-index'),
18 files = require('./src/files.js')(path.resolve(__dirname, process.argv[2] || 'files')); 19 files = require('./src/files.js')(path.resolve(__dirname, process.argv[2] || 'files'));
19 20
20var app = express(); 21var app = express();
@@ -30,10 +31,13 @@ router.get ('/api/healthcheck', function (req, res) { res.status(200).send();
30// welcome screen in case / does not serve up any file yet 31// welcome screen in case / does not serve up any file yet
31router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/app/welcome.html')); }); 32router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/app/welcome.html')); });
32 33
34var rootFolder = path.resolve(__dirname, process.argv[2] || 'files');
35
33app.use(morgan('dev')); 36app.use(morgan('dev'));
34app.use(compression()); 37app.use(compression());
35app.use('/_admin', express.static(__dirname + '/app')); 38app.use('/_admin', express.static(__dirname + '/app'));
36app.use(express.static(path.resolve(__dirname, process.argv[2] || 'files'))); 39app.use(express.static(rootFolder));
40app.use(serveIndex(rootFolder, { icons: true }));
37app.use(bodyParser.json()); 41app.use(bodyParser.json());
38app.use(bodyParser.urlencoded({ extended: false, limit: '100mb' })); 42app.use(bodyParser.urlencoded({ extended: false, limit: '100mb' }));
39app.use(cookieParser()); 43app.use(cookieParser());