diff options
-rwxr-xr-x | server.js | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 | ||
20 | var app = express(); | 21 | var 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 |
31 | router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/app/welcome.html')); }); | 32 | router.get('/', function (req, res) { res.status(200).sendFile(path.join(__dirname, '/app/welcome.html')); }); |
32 | 33 | ||
34 | var rootFolder = path.resolve(__dirname, process.argv[2] || 'files'); | ||
35 | |||
33 | app.use(morgan('dev')); | 36 | app.use(morgan('dev')); |
34 | app.use(compression()); | 37 | app.use(compression()); |
35 | app.use('/_admin', express.static(__dirname + '/app')); | 38 | app.use('/_admin', express.static(__dirname + '/app')); |
36 | app.use(express.static(path.resolve(__dirname, process.argv[2] || 'files'))); | 39 | app.use(express.static(rootFolder)); |
40 | app.use(serveIndex(rootFolder, { icons: true })); | ||
37 | app.use(bodyParser.json()); | 41 | app.use(bodyParser.json()); |
38 | app.use(bodyParser.urlencoded({ extended: false, limit: '100mb' })); | 42 | app.use(bodyParser.urlencoded({ extended: false, limit: '100mb' })); |
39 | app.use(cookieParser()); | 43 | app.use(cookieParser()); |