1
0
Fork 0
mirror of synced 2024-06-02 18:44:54 +12:00

Update preview endpoint to be prefixed with /app to not require an updated proxy config

This commit is contained in:
Andrew Kingston 2022-09-07 10:40:00 +01:00
parent 4ba16eaf0a
commit 8925cdf83e
5 changed files with 4 additions and 12 deletions

View file

@ -65,10 +65,6 @@ http {
proxy_pass http://{{ address }}:4001;
}
location /preview {
proxy_pass http://{{ address }}:4001;
}
location /builder {
proxy_pass http://{{ address }}:3000;
rewrite ^/builder(.*)$ /builder/$1 break;

View file

@ -88,10 +88,6 @@ http {
proxy_pass http://$apps:4002;
}
location /preview {
proxy_pass http://$apps:4002;
}
location = / {
proxy_pass http://$apps:4002;
}

View file

@ -290,7 +290,7 @@
<iframe
title="componentPreview"
bind:this={iframe}
src="/preview"
src="/app/preview"
class:hidden={loading || error}
class:tablet={$store.previewDevice === "tablet"}
class:mobile={$store.previewDevice === "mobile"}

View file

@ -56,7 +56,7 @@ router
authorized(PermissionTypes.TABLE, PermissionLevels.WRITE),
controller.deleteObjects
)
.get("/preview", authorized(BUILDER), controller.serveBuilderPreview)
.get("/app/preview", authorized(BUILDER), controller.serveBuilderPreview)
.get("/:appId/:path*", controller.serveApp)
.get("/app/:appUrl/:path*", controller.serveApp)
.post(

View file

@ -150,14 +150,14 @@ describe("/static", () => {
})
})
describe("/preview", () => {
describe("/app/preview", () => {
beforeEach(() => {
jest.clearAllMocks()
})
it("should serve the builder preview", async () => {
const headers = config.defaultHeaders()
const res = await request.get(`/preview`).set(headers).expect(200)
const res = await request.get(`/app/preview`).set(headers).expect(200)
expect(res.body.appId).toBe(config.appId)
expect(res.body.builderPreview).toBe(true)