aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@cloudron.io>2017-02-05 06:47:47 -0800
committerJohannes Zellner <johannes@cloudron.io>2017-02-05 06:47:47 -0800
commit74c0064c7dca1c0a96eef4962adb6cd61f33ec6c (patch)
tree5a04f71779acd7d96e71f6183514182320983725
parent42e38e8ca2b32d73d9a4378b5e57774db03e4c7c (diff)
downloadSurfer-74c0064c7dca1c0a96eef4962adb6cd61f33ec6c.tar.gz
Surfer-74c0064c7dca1c0a96eef4962adb6cd61f33ec6c.tar.zst
Surfer-74c0064c7dca1c0a96eef4962adb6cd61f33ec6c.zip
Fix the routing by using middleware selectively
-rwxr-xr-xserver.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/server.js b/server.js
index 4a67585..edd8a75 100755
--- a/server.js
+++ b/server.js
@@ -35,16 +35,16 @@ var rootFolder = path.resolve(__dirname, process.argv[2] || 'files');
35 35
36app.use(morgan('dev')); 36app.use(morgan('dev'));
37app.use(compression()); 37app.use(compression());
38app.use('/_admin', express.static(__dirname + '/frontend')); 38app.use('/api', bodyParser.json());
39app.use(express.static(rootFolder)); 39app.use('/api', bodyParser.urlencoded({ extended: false, limit: '100mb' }));
40app.use(serveIndex(rootFolder, { icons: true })); 40app.use('/api', cookieParser());
41app.use(bodyParser.json()); 41app.use('/api', session({ secret: 'surfin surfin', resave: false, saveUninitialized: false }));
42app.use(bodyParser.urlencoded({ extended: false, limit: '100mb' })); 42app.use('/api', passport.initialize());
43app.use(cookieParser()); 43app.use('/api', passport.session());
44app.use(session({ secret: 'surfin surfin', resave: false, saveUninitialized: false }));
45app.use(passport.initialize());
46app.use(passport.session());
47app.use(router); 44app.use(router);
45app.use('/_admin', express.static(__dirname + '/frontend'));
46app.use('/', express.static(rootFolder));
47app.use('/', serveIndex(rootFolder, { icons: true }));
48app.use(lastMile()); 48app.use(lastMile());
49 49
50var server = app.listen(3000, function () { 50var server = app.listen(3000, function () {