aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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());