mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
improved astro adapter (serving api) + added documentation
This commit is contained in:
@@ -1,21 +1,12 @@
|
||||
import type { APIRoute } from "astro";
|
||||
import { App } from "bknd";
|
||||
import { serve } from "bknd/adapter/astro";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
let app: App;
|
||||
export const ALL: APIRoute = async ({ request }) => {
|
||||
if (!app) {
|
||||
app = App.create({
|
||||
connection: {
|
||||
type: "libsql",
|
||||
config: {
|
||||
url: "http://127.0.0.1:8080"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
await app.build();
|
||||
export const ALL = serve({
|
||||
connection: {
|
||||
type: "libsql",
|
||||
config: {
|
||||
url: "http://127.0.0.1:8080"
|
||||
}
|
||||
}
|
||||
return app.fetch(request);
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user