-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.ts
48 lines (41 loc) · 906 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
/**
* Required external modules
*/
import express, { Application } from 'express';
import path from 'path';
/**
* Required internal modules
*/
import { info } from './logmanager';
import { DBManager } from './dbmanager';
import { loadRoutes } from './routemanager';
/**
* Required configuration sections
*/
import { website_port } from './config.json';
/**
* App Variables
*/
const app: Application = express();
/**
* SQL Connection.
*/
const db: DBManager = new DBManager();
db.createTables();
/**
* 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')));
/**
* Routes Definitions
*/
loadRoutes(app, db);
/**
* Server Activation
*/
app.listen(website_port, () => {
info(`Listening to requests at 127.0.0.1:${website_port}`);
});