-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
47 lines (34 loc) · 1.13 KB
/
index.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
42
43
44
45
46
47
var express = require('express');
var passport = require('passport');
var express_session = require('express-session')
require('./config/passport-local-strategy');
var connect_Mongo = require('connect-mongo');
var app = express();
require('./config/mongoose');
app.use(express.urlencoded());
var express_layout =require("express-ejs-layouts");
const MongoStore = require("connect-mongo");
app.use(express_layout);
app.set("view engine","ejs");
app.set("views",__dirname+"/views");
app.set('layout extractStyles',true);
app.set('layout extractScripts',true);
app.use(express.static('./Assets'));
app.use(express_session({
name : 'ERS',
secret : 'devil',
cookie : {
maxAge: 1000 * 60 * 60 * 24
},
store : connect_Mongo.create({
mongoUrl : 'mongodb+srv://mohitpal9513:[email protected]/ERS_System?retryWrites=true&w=majority'
})
}))
app.use(passport.initialize());
app.use(passport.session());
app.use(passport.setAuthenticatedUser);
var port =8000 || process.env.port;
app.use('/',require('./Router/index.js'));
app.listen(port,()=>{
console.log('server is running');
})