forked from ryuphi/astrology-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
51 lines (39 loc) · 831 Bytes
/
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
40
41
42
43
44
45
46
47
48
49
50
51
const express = require("express");
const helmet = require("helmet");
const cors = require("cors");
const morgan = require("morgan");
const app = express();
app.set("trust proxy", "loopback");
// cors
app.use(cors());
if (process.env.ENVIRONMENT !== "test") {
// logger
app.use(
morgan(
'[:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length]'
)
);
}
// helmet configurations
app.use(helmet());
app.use(helmet.referrerPolicy());
app.use(
helmet.contentSecurityPolicy({
directives: {
defaultSrc: ["'self'"],
},
})
);
app.use(
helmet.featurePolicy({
features: {
fullscreen: ["'self'"],
vibrate: ["'none'"],
syncXhr: ["'none'"],
},
})
);
app.use(express.json());
const api = require("./src/api");
app.use(api);
module.exports = app;