mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
added adapter exports, generalized env-depending config construction
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
import { type FrameworkBkndConfig, createFrameworkApp } from "adapter";
|
||||
import type { App } from "bknd";
|
||||
|
||||
export type RemixBkndConfig = FrameworkBkndConfig;
|
||||
export type RemixBkndConfig<Args = RemixContext> = FrameworkBkndConfig<Args>;
|
||||
|
||||
type RemixContext = {
|
||||
request: Request;
|
||||
};
|
||||
|
||||
let app: App;
|
||||
export function serve(config: RemixBkndConfig = {}) {
|
||||
return async (args: { request: Request }) => {
|
||||
export function serve<Args extends RemixContext = RemixContext>(
|
||||
config: RemixBkndConfig<Args> = {}
|
||||
) {
|
||||
return async (args: Args) => {
|
||||
if (!app) {
|
||||
app = await createFrameworkApp(config);
|
||||
app = await createFrameworkApp(config, args);
|
||||
}
|
||||
return app.fetch(args.request);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user