mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
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);
|
|
};
|