forked from Vince-9/SWJTU-dean-score-crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (26 loc) · 1.01 KB
/
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
const express = require('express');
const fs = require('fs');
const router = require('./router/router');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const Store = require('express-mysql-session');
const config = require('./module/sensitiveConfig');
const app = express();
app.use('/node_modules/', express.static('./node_modules/'));//映射静态资源
app.use('/public/', express.static('./public/'));
app.use(session({
secret: 'vincent targaryen', //secret的值建议使用随机字符串
cookie: { maxAge: 15 * 24 * 60 * 60 * 1000 }, // 过期时间(毫秒)
resave: false,
saveUninitiailzed: true,
store: new Store(config.mysql_config)
}));//session
app.engine('html', require('express-art-template'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(router);
const port = 80;
app.listen(port, () => {
console.log('教务成绩查询app running ' + port + '...');
});