-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
39 lines (31 loc) · 1.09 KB
/
app.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
const express = require('express');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const nunjucks = require('nunjucks');
const path = require('path');
const indexRouter = require("./app/routes/index");
const userRouter = require("./app/routes/user");
const adminRouter = require("./app/routes/admin");
const app = express();
const port = 3000;
const ipAddress = '0.0.0.0';
nunjucks.configure([
"node_modules/govuk-frontend/",
"app/views/"
], {
autoescape: true,
express: app,
});
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(logger('dev'));
app.use(express.static(path.join(__dirname, "public")));
app.use('/assets', express.static(path.join(__dirname, 'node_modules/govuk-frontend/govuk/assets')));
app.use('/govuk-frontend', express.static(path.join(__dirname, 'node_modules/govuk-frontend/govuk')));
app.use('/', indexRouter);
app.use('/user', userRouter);
app.use('/admin', adminRouter);
app.listen(port, ipAddress, () => {
console.log(`Server is running at http://${ipAddress}:${port}`);
});
module.exports = app;