-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
39 lines (35 loc) · 1.32 KB
/
server.js
File metadata and controls
39 lines (35 loc) · 1.32 KB
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 path = require('path');
const helmet = require('helmet');
const app = express();
app.use(helmet({
contentSecurityPolicy: {
directives: {
defaultSrc: ["'self'"],
styleSrc: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com", "https://*.hsforms.com", "https://*.hubspot.com"],
scriptSrc: ["'self'", "'unsafe-inline'", "'unsafe-eval'", "https://js.hsforms.net", "https://*.hsforms.com", "https://*.hubspot.com"],
connectSrc: ["'self'", "https://*.shapediver.com", "https://*.hubspot.com", "https://*.hsforms.com"],
imgSrc: [
"'self'",
"data:",
"blob:",
"https://*.hsforms.com",
"https://*.hubspot.com",
"https://res.cloudinary.com"
],
mediaSrc: ["'self'", "blob:"],
workerSrc: ["'self'", "blob:"],
fontSrc: ["'self'", "https://fonts.gstatic.com", "https://*.hsforms.com"],
frameSrc: ["https://*.hsforms.com", "https://*.hubspot.com"],
formAction: ["https://*.hsforms.com", "https://*.hubspot.com"],
},
},
}));
app.use(express.static(path.join(__dirname, 'dist')));
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'dist', 'index.html'));
});
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Server is up on port ${port}`);
});