1
0
Fork 0
mirror of synced 2024-06-30 03:50:37 +12:00
budibase/packages/server/api/routes/static.js
Martin McKeaveney 8f5845943a Auth working
2020-05-06 20:29:55 +01:00

21 lines
623 B
JavaScript

const Router = require("@koa/router");
const controller = require("../controllers/static");
const router = Router();
router
.param("file", async (file, ctx, next) => {
ctx.file = file && file.includes(".") ? file : "index.html";
// Serving the client library from your local dir in dev
if (ctx.isDev && ctx.file.startsWith("budibase-client")) {
ctx.devPath = "/tmp/.budibase";
}
await next();
})
.get("/_builder/:file*", controller.serveBuilder)
.get("/:appId/componentlibrary", controller.serveComponentLibrary)
.get("/:appId/:file*", controller.serveApp);
module.exports = router;