-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (33 loc) · 892 Bytes
/
index.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
36
37
38
39
40
41
42
43
44
var express = require('express');
var multer = require('multer');
var app = express();
var session = require('express-session');
var bodyParser = require('body-parser');
app.set('view engine', 'ejs');
app.use(express.static('public'));
app.use(session({
secret: 'keyboard cat',
cookie: {
maxAge: 60000
},
resave: true,
saveUninitialized: false
}));
// for parsing application/json
app.use(bodyParser.json());
// for parsing application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(function (req, res, next) {
res.locals.error = [];
return next();
});
require('./routes/main')(app);
app.use(function (err, req, res, next) {
res.status(500).send('Houston, we have a problem!');
//Flush out the stack to the console
console.error(err.stack);
});
const server = app.listen(3000, function () {
});