mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
fix(sveltekit): make adapter runtime-agnostic
Remove process.env default to support all SvelteKit runtimes (Node, Cloudflare Workers, Vercel Edge, Deno). Users now pass env explicitly via $env/dynamic/private.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
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);
|
||||
const bkndHandler = serve(config, env);
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
// Handle bknd API requests
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import type { PageServerLoad } from "./$types";
|
||||
import { getApp } from "bknd/adapter/sveltekit";
|
||||
import { env } from "$env/dynamic/private";
|
||||
import config from "../../bknd.config";
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
const app = await getApp(config);
|
||||
const app = await getApp(config, env);
|
||||
const api = app.getApi();
|
||||
|
||||
const todos = await api.data.readMany("todos");
|
||||
|
||||
Reference in New Issue
Block a user