mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
updated examples: astro, nextjs, remix, bun, node
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { App, type CreateAppConfig } from "bknd";
|
||||
|
||||
let app: App;
|
||||
export function serve(config: CreateAppConfig) {
|
||||
export function serve(config: CreateAppConfig & { beforeBuild?: (app: App) => Promise<void> }) {
|
||||
return async (args: { request: Request }) => {
|
||||
if (!app) {
|
||||
app = App.create(config);
|
||||
await config.beforeBuild?.(app);
|
||||
await app.build();
|
||||
}
|
||||
return app.fetch(args.request);
|
||||
|
||||
Reference in New Issue
Block a user