-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
42 lines (34 loc) · 985 Bytes
/
server.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
var express = require('express')
var path = require('path')
var app = express()
var session = require('express-session');
var ejs = require('ejs');
var http = require('http');
var server = http.Server(app);
var mongoStore = require('connect-mongo')(session);
var port = process.env.PORT || 3000;
require("dotenv").config();
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(express.static(path.join(__dirname,'/public')))
var mongoose = require("mongoose");
var db = mongoose.connection;
app.use(express.urlencoded({extended: true}))
app.use(express.json())
app.use(session({
secret: "xYzUCAchitkara",
resave: false,
saveUninitialized: false,
store: new mongoStore({
mongooseConnection: db
})
}))
// DB //
require("./config/db");
app.use('/',require('./Routes/'));
app.get('/', function(req,res) {
res.render('login');
})
server.listen(port, () => {
console.log('Running on port ' +port);
});