https://<worker-host-name>/cdn-cgi/trace i.e https://cloudflare.com/cdn-cgi/trace and look at colo= for the airport code of where the worker is runningwrangler.toml config? wrangler.toml config file and the CLI, the binding name seems to be used more like an environment variable that you can then use in your worker.1/31/24, 3:32 PM
npx wrangler d1 info <db-name>
[env.staging]
d1_databases = [
{ binding = "DB", database_name = "staging", database_id = "unique_db_id_1", migrations_dir = "migrations", preview_database_id = "DB_STAGING" },
]
workers_dev = true
[env.production]
d1_databases = [
{ binding = "DB", database_name = "production", database_id = "unique_db_id_2", migrations_dir = "migrations"},
]https://<worker-host-name>/cdn-cgi/traceimport { Hono } from "hono";
const app = new Hono<{
Bindings: {
DB: D1Database;
};
}>();
app.get("/", async (c) => {
const result = c.env.DB.prepare(`
select * from users where id = 420;
`);
const t = performance.now();
await result.first();
return c.text(`Query took ${performance.now() - t}ms`);
});
export default app;