-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
34 lines (30 loc) · 990 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
const express = require('express');
const bodyParser = require('body-parser');
const passport = require('passport');
const session = require('express-session');
const MySQLStore = require('express-mysql-session')(session);
const config = require('./config/config');
const passportConfig = require('./config/passport');
const auth = require('./routes/auth');
const user = require('./routes/user');
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(session({
secret: config.session.secret,
resave: config.session.resave,
saveUninitialized: config.session.saveUninitialized,
store: new MySQLStore({
host: config.mysql.host,
port: config.mysql.port,
user: config.mysql.user,
password: config.mysql.password,
database: config.mysql.database
})
}));
app.use(passport.initialize());
app.use(passport.session());
passportConfig();
app.use('/auth/', auth);
app.use('/user/', user);
module.exports = app;