blob: b7bd79f5f966ab6784278b3aa1d72f1df8a26cb4 (
plain)
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
|
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const morgan = require('morgan')
const config = require('./config')
const applicationInit = require('./routes/application')
const keyboards = require('./routes/keyboards')
const app = express()
const { origin } = new URL(config.APP_BASE_URL)
app.use(bodyParser.json())
app.use(cors({ origin }))
if (config.ENABLE_DEV_SERVER) {
applicationInit(app)
}
app.use(morgan('dev'))
app.get('/health', (req, res) => res.sendStatus(200))
app.use(keyboards)
config.ENABLE_GITHUB && app.use('/github', require('./routes/github'))
module.exports = app
|