-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.ts
42 lines (30 loc) · 900 Bytes
/
index.ts
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
import express from 'express';
import dotenv from 'dotenv';
import cors from 'cors';
const app = express()
const helmet = require('helmet')
dotenv.config()
// router
import steamPlayerStatusRouter from './routes/steam-player-status';
// middlewares
import notFoundMiddleware from './middleware/not-found';
import errorHandler from './middleware/error-handler';
app.set('trust proxy', 1)
app.use(express.json())
app.use(express.static('dist/public'))
app.use(cors())
app.use(
helmet.contentSecurityPolicy({
useDefaults: true,
directives: {
"img-src": ["'self'", "https: data:"],
"style-src": ['*', "'unsafe-inline'"]
}
})
)
app.use(steamPlayerStatusRouter)
app.use(notFoundMiddleware)
app.use(errorHandler)
const port: number | string = process.env.PORT || 5000
app.listen(port, () => console.log(`Listening on port ${port}`))
module.exports = app