aboutsummaryrefslogtreecommitdiffhomepage
path: root/api/index.js
blob: d45471ce4127d07ce398f6dc5e24a601051b4c58 (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
require('dotenv/config')
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const morgan = require('morgan')

const applicationInit = require('./routes/application')
const keyboards = require('./routes/keyboards')

const app = express()

app.use(bodyParser.json())
app.use(cors({
  origin: 'https://nickcoutsos.github.io'
}))

if (process.env.ENABLE_DEV_SERVER) {
  applicationInit(app)
}

app.use(morgan('dev'))
app.use(keyboards)
app.use('/github', require('./routes/github'))
app.get('/health', (req, res) => res.sendStatus(200))

module.exports = app