-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
61 lines (44 loc) · 1.48 KB
/
app.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
50
51
52
53
54
55
56
57
58
59
60
61
import { Request, Response } from "express"
import session = require("express-session");
import { delivEmp } from "./model/delivEmp";
const express = require('express');
const path = require('path');
const nunjucks = require('nunjucks')
const dateFilter = require('nunjucks-date-filter');
const app = express();
var appViews = path.join(__dirname, '/views/')
var nunjucksConfig = {
autoescape: true,
noCache: true,
express: app
}
let config = nunjucks.configure(appViews, nunjucksConfig)
config.addFilter('date', dateFilter);
app.set('view engine', 'html')
app.use('/public', express.static(path.join(__dirname, 'public')))
app.use(express.json())
app.use(express.urlencoded({ extended: true }));
app.use(session({ secret: 'NOT HARDCODED SECRET', cookie: { maxAge: 60000}}))
declare module 'express-session' {
interface SessionData {
delivEmp: delivEmp;
}
}
app.listen(3000, () => {
console.log('Server listening on port 3000');
})
app.get('/', (req: Request, res: Response) => {
res.render('template.html')
})
app.get('/hr-team.html', async (req: Request, res: Response) => {
res.render('hr-team.html')
})
app.get('/management-team.html', async (req: Request, res: Response) => {
res.render('management-team.html')
})
app.get('/sales-team.html', async (req: Request, res: Response) => {
res.render('sales-team.html')
})
//add require paths here!
require('./controller/salesEmployeeController')(app);
require('./controller/delivEmpController')(app);