2020-02-03 10:24:25 +01:00
|
|
|
const Koa = require("koa")
|
2020-05-07 11:53:34 +02:00
|
|
|
const logger = require("koa-logger")
|
2020-04-29 21:29:42 +02:00
|
|
|
const router = require("./api")
|
2020-02-03 10:24:25 +01:00
|
|
|
const koaBody = require("koa-body")
|
|
|
|
const app = new Koa()
|
2019-06-14 11:05:46 +02:00
|
|
|
|
2020-04-24 18:28:32 +02:00
|
|
|
module.exports = async () => {
|
|
|
|
app.keys = Object.keys(process.env)
|
|
|
|
.filter(k => k.startsWith("COOKIE_KEY_"))
|
|
|
|
.map(k => process.env[k])
|
2020-05-04 18:13:57 +02:00
|
|
|
|
2020-02-03 10:24:25 +01:00
|
|
|
app.use(koaBody({ multipart: true }))
|
2020-04-24 18:28:32 +02:00
|
|
|
app.use(logger())
|
|
|
|
app.use(router(app).routes())
|
2020-05-04 18:13:57 +02:00
|
|
|
|
2020-04-24 18:28:32 +02:00
|
|
|
return app.listen(process.env.PORT || 4001)
|
2020-02-03 10:24:25 +01:00
|
|
|
}
|