1
0
Fork 0
mirror of synced 2024-07-04 14:01:27 +12:00
budibase/packages/server/app.js

21 lines
664 B
JavaScript
Raw Normal View History

2019-06-14 21:05:46 +12:00
const Koa = require('koa');
const app = new Koa();
const getMasterAppInternal = require("./utilities/masterAppInternal");
const router = require("./middleware/routers");
const bodyParser = require('koa-bodyparser');
2019-06-26 09:48:22 +12:00
const initialiseRuntimeApps = require("./initialise/initialiseRuntimePackages");
2019-06-14 21:05:46 +12:00
module.exports = async (config) => {
app.keys = config.keys;
app.context.master = await getMasterAppInternal(config);
2019-06-26 09:48:22 +12:00
app.context.getAppPackage = await initialiseRuntimeApps(
config,
app.context.master,
config.latestAppsPath
)
2019-06-14 21:05:46 +12:00
app.use(bodyParser());
2019-06-15 04:01:01 +12:00
app.use(router(config, app).routes());
2019-06-14 21:05:46 +12:00
return app.listen();
};