forked from lucascalheiros/systock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (24 loc) · 733 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
let bodyParser = require('body-parser');
let express = require('express');
let app = express();
var session = require('express-session');
var flash = require('req-flash');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(session({
secret: 'djhxcvxfgshajfgjhgsjhfgsakjeauytsdfy',
resave: false,
saveUninitialized: true
}));
app.use(flash());
app.use(express.static('static'));
let auth = require('./src/routers/auth');
app.set('view engine', 'ejs');
app.use('/', auth.router);
app.get('/', auth.checkLogin, function(req,res){
res.render('./index.ejs', {
loggedUser: req.session.user,
success: req.flash('success')
});
req.flash('success', null);
});
module.exports = app;