docs: corrected app function parameter signature

This commit is contained in:
dswbx
2025-09-15 14:36:00 +02:00
parent c11dd2bd9e
commit ddfc3e599f
3 changed files with 7 additions and 7 deletions

View File

@@ -52,17 +52,17 @@ export default serve();
// manually specifying a D1 binding: // manually specifying a D1 binding:
export default serve<Env>({ export default serve<Env>({
app: ({ env }) => d1({ binding: env.D1_BINDING }), app: (env) => d1({ binding: env.D1_BINDING }),
}); });
// or specify binding using `bindings` // or specify binding using `bindings`
export default serve<Env>({ export default serve<Env>({
bindings: ({ env }) => ({ db: env.D1_BINDING }), bindings: (env) => ({ db: env.D1_BINDING }),
}); });
// or use LibSQL // or use LibSQL
export default serve<Env>({ export default serve<Env>({
app: ({ env }) => ({ url: env.DB_URL }), app: (env) => ({ url: env.DB_URL }),
}); });
``` ```
@@ -199,7 +199,7 @@ import { d1 } from "bknd/adapter/cloudflare";
import { withPlatformProxy } from "bknd/adapter/cloudflare/proxy"; import { withPlatformProxy } from "bknd/adapter/cloudflare/proxy";
export default withPlatformProxy({ export default withPlatformProxy({
app: ({ env }) => ({ app: (env) => ({
connection: d1({ binding: env.DB }), connection: d1({ binding: env.DB }),
}), }),
}); });
@@ -217,7 +217,7 @@ Instead, it's recommended to split this configuration into separate files, e.g.
import type { CloudflareBkndConfig } from "bknd/adapter/cloudflare"; import type { CloudflareBkndConfig } from "bknd/adapter/cloudflare";
export default { export default {
app: ({ env }) => ({ app: (env) => ({
connection: d1({ binding: env.DB }), connection: d1({ binding: env.DB }),
}), }),
} satisfies CloudflareBkndConfig; } satisfies CloudflareBkndConfig;

View File

@@ -86,7 +86,7 @@ export default {
url: "file:data.db", url: "file:data.db",
}, },
// or use the `app` function which passes the environment variables // or use the `app` function which passes the environment variables
app: ({ env }) => ({ app: (env) => ({
connection: { connection: {
url: env.DB_URL, url: env.DB_URL,
}, },

View File

@@ -147,7 +147,7 @@ To manually specify which D1 database to take, you can specify it explicitly:
import { serve, d1 } from "bknd/adapter/cloudflare"; import { serve, d1 } from "bknd/adapter/cloudflare";
export default serve<Env>({ export default serve<Env>({
app: ({ env }) => d1({ binding: env.D1_BINDING }), app: (env) => d1({ binding: env.D1_BINDING }),
}); });
``` ```