-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
35 lines (31 loc) · 1.04 KB
/
server.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 bodyParser = require('body-parser');
const express = require('express');
const session = require('express-session');
const passport = require('passport');
const app = express();
app.use(express.json());
app.use(express.urlencoded({extended:false}));
app.use(session({
secret: 'keyboardcat',
resave: false,
saveUninitialized: false,
}))
app.use(passport.initialize());
app.use(passport.session());
passport.serializeUser(function (user, done) {
done(null, user);
});
passport.deserializeUser(function (user, done) {
done(null, user);
});
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "http://localhost:3000");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.header("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, OPTIONS")
res.header("Access-Control-Allow-Credentials", true);
next();
});
app.use('/', require('./server/controllers'));
app.listen(10036, function () {
console.log('Example app listening on port 10036!');
});