-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (18 loc) · 772 Bytes
/
app.js
File metadata and controls
24 lines (18 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import express from 'express'
import compression from 'compression'
import swaggerUi from 'swagger-ui-express'
import { readFileSync } from 'fs'
import routes from './routes.js'
const openApiDocument = JSON.parse(readFileSync('./openapi.json', 'utf-8'))
const app = express()
app.use(compression())
app.use(express.static('public', { maxAge: '1d' }))
app.set('views', './views')
app.set('view engine', 'pug')
app.get('/', (req, res) => res.render('index'))
app.get('/about', (req, res) => res.render('about'))
app.get('/accessibility', (req, res) => res.render('accessibility'))
app.get('/privacy', (req, res) => res.render('privacy'))
app.use('/api/', routes)
app.use('/api/', swaggerUi.serve, swaggerUi.setup(openApiDocument))
app.listen(process.env.PORT || 3000)