mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
7e8b357bbb
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`.
20 lines
547 B
TypeScript
20 lines
547 B
TypeScript
import type { Handle } from "@sveltejs/kit";
|
|
import { serve } from "bknd/adapter/sveltekit";
|
|
import { env } from "$env/dynamic/private";
|
|
import config from "../bknd.config";
|
|
|
|
const bkndHandler = serve(config, env);
|
|
|
|
export const handle: Handle = async ({ event, resolve }) => {
|
|
// Handle bknd API requests
|
|
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);
|
|
};
|