1
0
Fork 0
mirror of synced 2024-06-29 11:31:06 +12:00
budibase/packages/server/src/api/routes/dev.js

27 lines
901 B
JavaScript
Raw Normal View History

const Router = require("@koa/router")
const controller = require("../controllers/dev")
const env = require("../../environment")
2021-05-13 04:43:01 +12:00
const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/backend-core/permissions")
const router = new Router()
function redirectPath(path) {
router
.get(`/api/${path}/:devPath(.*)`, controller.buildRedirectGet(path))
.post(`/api/${path}/:devPath(.*)`, controller.buildRedirectPost(path))
.delete(`/api/${path}/:devPath(.*)`, controller.buildRedirectDelete(path))
}
if (env.isDev() || env.isTest()) {
redirectPath("global")
redirectPath("system")
}
2021-05-17 08:25:37 +12:00
router
.get("/api/dev/version", authorized(BUILDER), controller.getBudibaseVersion)
2021-05-17 08:25:37 +12:00
.delete("/api/dev/:appId/lock", authorized(BUILDER), controller.clearLock)
.post("/api/dev/:appId/revert", authorized(BUILDER), controller.revert)
2021-05-13 04:43:01 +12:00
module.exports = router