_builder routing servs index for non-file paths
This commit is contained in:
parent
b94632ed62
commit
c538cee59c
|
@ -101,10 +101,14 @@ module.exports = (config, app) => {
|
||||||
.get("/_builder/*", async (ctx, next) => {
|
.get("/_builder/*", async (ctx, next) => {
|
||||||
const path = ctx.path.replace("/_builder", "")
|
const path = ctx.path.replace("/_builder", "")
|
||||||
|
|
||||||
|
const isFile = new RegExp(/(.+\..{1,5})/g).test(path)
|
||||||
|
|
||||||
if (path.startsWith("/api/") || path.startsWith("/instance/")) {
|
if (path.startsWith("/api/") || path.startsWith("/instance/")) {
|
||||||
await next()
|
await next()
|
||||||
} else {
|
} else if (isFile) {
|
||||||
await send(ctx, path, { root: builderPath })
|
await send(ctx, path, { root: builderPath })
|
||||||
|
} else {
|
||||||
|
await send(ctx, "/index.html", { root: builderPath })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.post("/:appname/api/authenticate", routeHandlers.authenticate)
|
.post("/:appname/api/authenticate", routeHandlers.authenticate)
|
||||||
|
|
Loading…
Reference in New Issue