18 lines
436 B
JavaScript
18 lines
436 B
JavaScript
const Koa = require("koa")
|
|
const logger = require("koa-logger")
|
|
const router = require("./api")
|
|
const koaBody = require("koa-body")
|
|
const app = new Koa()
|
|
|
|
module.exports = () => {
|
|
app.keys = Object.keys(process.env)
|
|
.filter(k => k.startsWith("COOKIE_KEY_"))
|
|
.map(k => process.env[k])
|
|
|
|
app.use(koaBody({ multipart: true }))
|
|
app.use(logger())
|
|
app.use(router(app).routes())
|
|
|
|
return app.listen(process.env.PORT || 4001)
|
|
}
|