budibase/packages/server/app.js

16 lines
441 B
JavaScript
Raw Normal View History

const Koa = require("koa")
2020-04-07 16:12:08 +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-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])
app.use(koaBody({ multipart: true }))
2020-04-24 18:28:32 +02:00
app.use(logger())
app.use(router(app).routes())
return app.listen(process.env.PORT || 4001)
}