-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.js
38 lines (31 loc) · 1.2 KB
/
server.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
// Own module to contain deployment-specific server.js information
const serverConfiguration = require("./serverConfiguration.js");
const path = require("path");
const express = require("express");
const helmet = require("helmet");
const DIST_DIR = path.join(__dirname, "public");
const PORT = 80;
const app = express();
//Serving the files on the dist folder
app.use(express.static(DIST_DIR));
// Tweak rules so that it allows off-site logo & sourire images
app.use(helmet.contentSecurityPolicy( serverConfiguration.contentSecurityPolicy ));
// app.use(helmet.crossOriginEmbedderPolicy());
// app.use(helmet.crossOriginOpenerPolicy());
app.use(helmet.crossOriginResourcePolicy({ policy: "cross-origin" }));
app.use(helmet.dnsPrefetchControl());
app.use(helmet.expectCt());
app.use(helmet.frameguard());
app.use(helmet.hidePoweredBy());
app.use(helmet.hsts());
app.use(helmet.ieNoOpen());
app.use(helmet.noSniff());
app.use(helmet.originAgentCluster());
app.use(helmet.permittedCrossDomainPolicies());
app.use(helmet.referrerPolicy());
app.use(helmet.xssFilter());
//Send index.html when the user access the web
app.get("*", function (req, res) {
res.sendFile(path.join(DIST_DIR, "index.html"));
});
app.listen(PORT);