budibase/packages/server/src/app.js

18 lines
436 B
JavaScript
Raw Normal View History

const Koa = require("koa")
2020-05-07 11:53:34 +02:00
const logger = require("koa-logger")
const router = require("./api")
const koaBody = require("koa-body")
const app = new Koa()
2019-06-14 11:05:46 +02:00
2020-05-07 14:33:25 +02:00
module.exports = () => {
2020-04-24 18:28:32 +02:00
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
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)
}