-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (24 loc) · 814 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
const express=require("express");
const path=require("path");
const app=express();
const mainRouter = require('./routes/index.js');
const PORT = process.env.PORT || 3000;
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/hostelManagementApplication');
const bodyParser = require('body-parser')
app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
const passport = require("passport");
const cookieSession = require("cookie-session");
app.use(cookieSession({
keys: [process.env.SESSION_SECRET],
maxAge: 24 * 60 * 60 * 1000
}));
app.use(passport.initialize());
app.use(passport.session());
app.set('view engine','ejs');
app.use(express.static('public'));
app.use(mainRouter);
app.listen(PORT,()=>{
console.log("running on port " + PORT);
})