-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathindex.js
40 lines (35 loc) · 1001 Bytes
/
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
// Requiring Packages - Start
const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const backend = require("./backend");
const backRoutes = require("./backend/app");
const session = require("client-sessions");
const logger = require("morgan");
// Requiring Packages - End
// configure app
const app = express(); // define our app using express
//Use logger
app.use(logger("dev"));
app.use(
bodyParser.urlencoded({
extended: true
})
); // For parsing URL encoded Data
app.use(bodyParser.json()); // Parse to json object
// app.use(express.static("docs"));
// use session middleware
app.use(
session({
cookieName: "session",
secret: "secret",
duration: 30 * 60 * 1000,
activeDuration: 5 * 60 * 1000
})
);
//Use to the EJS Templating Engine for dynamic injection of data into views.
// view engine setup
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "ejs");
backRoutes(app);
backend(app);