Skip to content

Commit 795e8d6

Browse files
committed
Added home partially
1 parent 2d3309c commit 795e8d6

10 files changed

Lines changed: 256 additions & 41 deletions

File tree

package-lock.json

Lines changed: 164 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"compression": "^1.7.4",
3737
"convict": "^5.1.0",
3838
"copy": "^0.3.2",
39-
"ejs": "^3.1.3",
4039
"errorhandler": "^1.5.1",
4140
"express": "^4.17.1",
4241
"glob": "^7.1.6",
@@ -45,6 +44,7 @@
4544
"mandrill-api": "^1.0.45",
4645
"mongodb": "^3.5.2",
4746
"node-dependency-injection": "^2.4.2",
47+
"nunjucks": "^3.2.1",
4848
"ts-node": "^8.3.0",
4949
"typescript": "^3.7.2",
5050
"uuid": "^3.3.3",
@@ -56,6 +56,7 @@
5656
"@types/cucumber": "^4.0.7",
5757
"@types/faker": "^4.1.5",
5858
"@types/jest": "^24.0.18",
59+
"@types/nunjucks": "^3.1.3",
5960
"@types/supertest": "^2.0.8",
6061
"cucumber": "^6.0.5",
6162
"faker": "^4.1.0",

src/apps/backoffice/frontend/app.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ import helmet from 'helmet';
44
import compress from 'compression';
55
import { registerRoutes } from './routes';
66
import path from 'path';
7+
import nunjucks from 'nunjucks';
78

89
const app: express.Express = express();
910

1011
app.set('port', process.env.PORT || 8032);
11-
app.set('view engine', 'ejs');
12-
app.set('views', path.join(__dirname, '/views'));
1312

13+
// Templates
14+
app.set('view engine', 'html');
15+
nunjucks.configure(path.join(__dirname, '/templates'), {
16+
autoescape: true,
17+
express: app,
18+
watch: true
19+
});
20+
21+
app.use(express.static(path.join(__dirname, '/public')));
1422
app.use(bodyParser.json());
1523
app.use(bodyParser.urlencoded({ extended: true }));
1624
app.use(helmet.xssFilter());

src/apps/backoffice/frontend/controllers/HomeGetController.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { Request, Response } from 'express';
22

33
export class HomeGetController {
44
run(req: Request, res: Response) {
5-
res.render('index', { foo: 'FOO' });
5+
res.render('pages/home', {
6+
title: 'Welcome',
7+
description: 'CodelyTV - Backoffice'
8+
});
69
}
710
}
4.09 KB
Loading

0 commit comments

Comments
 (0)