-
Notifications
You must be signed in to change notification settings - Fork 37
/
server.js
42 lines (29 loc) · 975 Bytes
/
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
36
37
38
39
40
41
var express = require('express'),
http = require('http'),
fs = require('fs'),
passport = require('passport'),
routes = require('./routes').routes;
var app = express();
app.use(express.logger());
app.use(express.compress());
app.use(express.bodyParser());
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(user, done) {
done(null, user);
});
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({
secret : 'almvnirtgd#$DFsa25452*AYD*D*S!@!#adsda))Ddsadsax',
cookie: {httpOnly: true, secure: false, maxAge: 86400000},
store: new express.session.MemoryStore()
}));
app.use(passport.initialize());
app.use(passport.session());
routes(app, JSON.parse(fs.readFileSync('initial_data.json')));
app.use('/', express.static(__dirname + '/app'));
var port = process.env.PORT || 8000;
app.listen(port);
console.log('Please go to http://localhost:' + port);