From d29dffe7e45074835b45e4329bfdc953048d789a Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 6 Apr 2020 14:28:22 +0100 Subject: [PATCH] fixing tests --- .../testApp/pages/main/screens/newscreen.json | 7 ------ packages/server/middleware/routers.js | 2 +- packages/server/middleware/routes/pages.js | 24 ++++++++++--------- 3 files changed, 14 insertions(+), 19 deletions(-) delete mode 100644 packages/server/appPackages/testApp/pages/main/screens/newscreen.json diff --git a/packages/server/appPackages/testApp/pages/main/screens/newscreen.json b/packages/server/appPackages/testApp/pages/main/screens/newscreen.json deleted file mode 100644 index 73570595a7..0000000000 --- a/packages/server/appPackages/testApp/pages/main/screens/newscreen.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "newscreen", - "props": { - "_component": "@budibase/standard-component/div", - "className": "something else" - } -} diff --git a/packages/server/middleware/routers.js b/packages/server/middleware/routers.js index f22220cf16..9deb6fcbf7 100644 --- a/packages/server/middleware/routers.js +++ b/packages/server/middleware/routers.js @@ -15,7 +15,7 @@ const { authenticatedRoutes } = require("./routes"); -const builderPath = resolve(__dirname, "../../builder") +const builderPath = resolve(__dirname, "../builder") module.exports = (config, app) => { const router = new Router() diff --git a/packages/server/middleware/routes/pages.js b/packages/server/middleware/routes/pages.js index bde3aeeb4c..0c41e8f164 100644 --- a/packages/server/middleware/routes/pages.js +++ b/packages/server/middleware/routes/pages.js @@ -3,12 +3,24 @@ const StatusCodes = require("../../utilities/statusCodes") const { listScreens, saveScreen, - buildPage + buildPage, + renameScreen, + deleteScreen } = require("../../utilities/builder") const router = Router() +router.post("/_builder/api/:appname/pages/:pageName", async ctx => { + await buildPage( + ctx.config, + ctx.params.appname, + ctx.params.pageName, + ctx.request.body + ) + ctx.response.status = StatusCodes.OK +}) + router.get("/_builder/api/:appname/pages/:pagename/screens", async ctx => { ctx.body = await listScreens( ctx.config, @@ -58,14 +70,4 @@ router ctx.response.status = StatusCodes.OK }) -router.post("/_builder/api/:appname/pages/:pageName", async ctx => { - await buildPage( - ctx.config, - ctx.params.appname, - ctx.params.pageName, - ctx.request.body - ) - ctx.response.status = StatusCodes.OK -}) - module.exports = router \ No newline at end of file