1
0
Fork 0
mirror of synced 2024-07-01 12:30:41 +12:00
budibase/packages/server/api/routes/static.js

21 lines
610 B
JavaScript
Raw Normal View History

const Router = require("@koa/router");
2020-05-05 04:13:57 +12:00
const controller = require("../controllers/static");
const router = Router();
router
.param("file", async (file, ctx, next) => {
ctx.file = file && file.includes(".") ? file : "index.html";
2020-05-06 23:17:15 +12:00
// Serving the latest client library in dev
if (ctx.isDev && ctx.file.startsWith("budibase-client")) {
ctx.devPath = "/tmp/.budibase";
}
await next();
})
.get("/_builder/:file*", controller.serveBuilder)
2020-05-05 04:13:57 +12:00
.get("/:appId/componentlibrary", controller.serveComponentLibrary)
.get("/:appId/:file*", controller.serveApp);
module.exports = router;