add support for /admin route in backend handler and enable asset copying

updated `hooks.server.ts` to handle `/admin` routes and prevent fallback for 404 responses. added `adminBasepath` config to match backend paths. introduced assets copying step via `postinstall` script and included `robots.txt` and `favicon.ico` under `static`.
This commit is contained in:
dswbx
2026-01-09 13:11:01 +01:00
parent 521d8bc6ff
commit 7e8b357bbb
6 changed files with 17 additions and 3 deletions

View File

@@ -7,8 +7,12 @@ const bkndHandler = serve(config, env);
export const handle: Handle = async ({ event, resolve }) => {
// Handle bknd API requests
if (event.url.pathname.startsWith("/api/")) {
return bkndHandler(event);
const pathname = event.url.pathname;
if (pathname.startsWith("/api/") || pathname.startsWith("/admin")) {
const res = await bkndHandler(event);
if (res.status !== 404) {
return res;
}
}
return resolve(event);