-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
41 lines (30 loc) · 899 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
const express = require('express')
const config = require('./utility/config')
const logger = require('./utility/logger')
const cors = require('cors')
const session = require('express-session')
const bodyParser = require('body-parser')
const app = express()
const port = global.getConfig()['port']
// var whitelist = ['http://example1.com', 'http://example2.com']
// app.use(cors({
// origin: function (origin, callback) {
// if (whitelist.indexOf(origin) !== -1) {
// callback(null, true)
// } else {
// callback(new Error('Not allowed by CORS'))
// }
// }
// }));
app.use(cors());
app.use(bodyParser.json());
app.use(session({
secret: "_",
resave: false,
saveUninitialized: true,
cookie: { secure: true }
}));
require('./router/loader')(app)
app.listen(port, () => {
logger.info(`Example app listening at http://localhost:${port}`)
})