-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
53 lines (44 loc) · 1.26 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
48
49
50
51
52
53
const { urlencoded } = require("express");
const express = require("express");
const mongoose = require('mongoose');
const cookie = require("cookie-parser");
const port = 8001;
const app = express();
mongoose.connect('mongodb+srv://harshilsonani09:[email protected]/liveAdmin').then(()=>{
console.log('database connected')
}).catch((err)=>{
console.log('database not connected');
});
const passport = require("passport");
const passportLocal = require("./config/passport-local-strategy");
const session = require("express-session");
const flash = require("connect-flash");
const flashMiddleware = require("./config/flashMiddleware");
app.use(urlencoded());
app.use(cookie());
app.use(express.static("assets"));
app.set("view engine", "ejs");
app.use(
session({
name: "harshil",
secret: "RNW",
saveUninitialized: false,
resave: true,
cookie: {
maxAge: 60 * 100 * 1000,
},
})
);
app.use(passport.initialize());
app.use(passport.session());
app.use(passport.setAuth);
app.use(flash());
app.use(flashMiddleware.set);
app.use("/", require("./route/indexRouter"));
app.listen(port, (err) => {
if (err) {
console.log("server is not response");
return false;
}
console.log("server is respoding", port);
});