diff options
author | Johannes Zellner <johannes@cloudron.io> | 2017-02-05 06:47:47 -0800 |
---|---|---|
committer | Johannes Zellner <johannes@cloudron.io> | 2017-02-05 06:47:47 -0800 |
commit | 74c0064c7dca1c0a96eef4962adb6cd61f33ec6c (patch) | |
tree | 5a04f71779acd7d96e71f6183514182320983725 | |
parent | 42e38e8ca2b32d73d9a4378b5e57774db03e4c7c (diff) | |
download | Surfer-74c0064c7dca1c0a96eef4962adb6cd61f33ec6c.tar.gz Surfer-74c0064c7dca1c0a96eef4962adb6cd61f33ec6c.tar.zst Surfer-74c0064c7dca1c0a96eef4962adb6cd61f33ec6c.zip |
Fix the routing by using middleware selectively
-rwxr-xr-x | server.js | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -35,16 +35,16 @@ var rootFolder = path.resolve(__dirname, process.argv[2] || 'files'); | |||
35 | 35 | ||
36 | app.use(morgan('dev')); | 36 | app.use(morgan('dev')); |
37 | app.use(compression()); | 37 | app.use(compression()); |
38 | app.use('/_admin', express.static(__dirname + '/frontend')); | 38 | app.use('/api', bodyParser.json()); |
39 | app.use(express.static(rootFolder)); | 39 | app.use('/api', bodyParser.urlencoded({ extended: false, limit: '100mb' })); |
40 | app.use(serveIndex(rootFolder, { icons: true })); | 40 | app.use('/api', cookieParser()); |
41 | app.use(bodyParser.json()); | 41 | app.use('/api', session({ secret: 'surfin surfin', resave: false, saveUninitialized: false })); |
42 | app.use(bodyParser.urlencoded({ extended: false, limit: '100mb' })); | 42 | app.use('/api', passport.initialize()); |
43 | app.use(cookieParser()); | 43 | app.use('/api', passport.session()); |
44 | app.use(session({ secret: 'surfin surfin', resave: false, saveUninitialized: false })); | ||
45 | app.use(passport.initialize()); | ||
46 | app.use(passport.session()); | ||
47 | app.use(router); | 44 | app.use(router); |
45 | app.use('/_admin', express.static(__dirname + '/frontend')); | ||
46 | app.use('/', express.static(rootFolder)); | ||
47 | app.use('/', serveIndex(rootFolder, { icons: true })); | ||
48 | app.use(lastMile()); | 48 | app.use(lastMile()); |
49 | 49 | ||
50 | var server = app.listen(3000, function () { | 50 | var server = app.listen(3000, function () { |