-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
39 lines (33 loc) · 1.14 KB
/
main.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
var express = require('express');
var flash = require('connect-flash');
//var crypto = require('crypto');
var passport = require('passport');
//var LocalStrategy = require('passport-local').Strategy;
//var connection = require('./lib/dbconn.js');
var sess = require('express-session');
var Store = require('express-session').Store;
var BetterMemoryStore = require('session-memory-store')(sess);
var engine = require('ejs-locals');
var store = new BetterMemoryStore({ expires: 60 * 60 * 1000, debug: true });
var bodyParser = require('body-parser');
var app=express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
var routes = require('./lib/routes.js');
app.use(express.static("public"));
app.use(sess({
name: 'JSESSION',
secret: 'MYSECRETISVERYSECRET',
store: store,
resave: true,
saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(flash());
app.use(express.static(__dirname + '/public'));
app.engine('ejs', engine);
app.set('views', __dirname + '/views/');
app.set('view engine', 'ejs');
app.use('/', routes);
app.listen(8080);