-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (26 loc) · 820 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const express = require('express');
const bodyparser = require('body-parser');
const routes = require('./routes/index');
const errorHandlers = require('./handlers/errorHandlers');
const path = require('path');
const session = require('express-session');
const cors = require('cors');
const fileUpload = require('express-fileupload');
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.use(bodyparser.json({limit: '50mb'}));
app.use(bodyparser.urlencoded({extended: true, limit: '50mb'}));
app.use(session({
secret: "secret",
key: "session",
resave: false,
saveUninitialized: false,
}));
app.use(cors());
app.use(fileUpload());
app.use((req, res, next) => {
next();
});
app.use('/', routes);
app.use(errorHandlers.flashValidationErrors);
module.exports = app;