-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.ts
49 lines (43 loc) · 997 Bytes
/
server.ts
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
/**
* Required external modules
*/
import express, { Application } from 'express';
import path from 'path';
import session from 'express-session';
/**
* Required internal modules
*/
import { info } from './logmanager';
import { loadRoutes } from './routemanager';
/**
* Required configuration sections
*/
import { website_port, session_secret } from './config.json';
/**
* App Variables
*/
const app: Application = express();
const oneDay = 1000 * 60 * 60 * 24;
/**
* App Configuration
*/
app.use(express.json());
app.set('views', path.join(path.join(__dirname, 'views'), 'frontend'));
app.set('view engine', 'pug');
app.use(express.static(path.join(__dirname, 'public')));
app.use(session({
secret: session_secret,
saveUninitialized: true,
cookie: { maxAge: oneDay },
resave: false,
}));
/**
* Routes Definitions
*/
loadRoutes(app);
/**
* Server Activation
*/
app.listen(website_port, () => {
info(`Listening to requests at 127.0.0.1:${website_port}`);
});