-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
47 lines (33 loc) · 983 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const express = require('express');
const bodyParser = require("body-parser");
require("ejs");
const session = require("express-session");
const config = require('config');
const authRoutes = require("./route/auth");
const dashboardRoutes = require('./route/dashboard');
var app = express();
app.set("view engine","ejs");
app.use(express.static(__dirname + "/public"));
app.use(
session({
secret: "vffdvfdhjkvbsdjfvbjsdbcjhdasgchjadsgchjadshcs",
resave: false,
saveUninitialized: true,
cookie: { secure: false }
})
);
app.use(bodyParser.urlencoded({ extended: true }));
app.set("trust proxy", 1); // trust first proxy
if(!config.get('jwtPrivateKey')){
console.log("FATAL ERROR: jwtPrivateKey not defined");
process.exit(1);
}
app.use(authRoutes);
app.use(dashboardRoutes);
app.get("/",(req,res)=>{
res.send("Welcome");
});
var port = process.env.PORT || 4000;
app.listen(port,process.env.IP,()=>{
console.log(`Server is up on ${port}`);
});