budibase/packages/server/app.js

23 lines
703 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("./middleware/routers")
const koaBody = require("koa-body")
const initialiseRuntimePackages = require("./initialise/initialiseRuntimePackages")
2019-06-14 11:05:46 +02:00
const app = new Koa()
2019-06-14 11:05:46 +02:00
module.exports = async budibaseContext => {
const { config } = budibaseContext
app.keys = config.keys
app.context.master = budibaseContext.master
2020-04-09 17:53:48 +02:00
// app.context.getAppPackage = await initialiseRuntimePackages(
// budibaseContext,
// app.context.master,
// config.latestPackagesFolder
// )
app.use(koaBody({ multipart: true }))
2020-04-07 16:12:08 +02:00
app.use(logger());
app.use(router(config, app).routes())
return app.listen(config.port)
}