@kian @Vy Thanks for a quick reply! Is it ok if I use the rest api from a worker to do this for the
@kian @Vy Thanks for a quick reply! Is it ok if I use the rest api from a worker to do this for the time being?
yarn dev, I want to use a local D1 created with npx wrangler d1 somecommand --local in api/foo/bar/route.ts. However, even after referring to the following page, I can't seem to bind it properly in my local environment. 
wrangler d1 execute like you did;await.{"served_by":"v3-prod","duration":0.6271,"changes":0,"last_row_id":0,"changed_db":false,"size_after":144568320,"rows_read":1,"rows_written":0}const result = await env.DB.prepare(
SELECT *
FROM weekly
WHERE weekNumber = ?1
)
.bind(weekNumber)
.first()result {"_id":1,"weekNumber":3,"topic":"What [object Object]
const db = getDrizzle(d1: D1Database) => {
if (!db.cached) {
db.cached = drizzle(d1);
}
return db;
}
export default {
async fetch(request: Request, env: Env) {
const db = getDrizzle(env.DB);
...
}
}const result = await env.DB.prepare(
SELECT *
FROM weekly
WHERE weekNumber = ?1
)
.bind(weekNumber)
.first()const result = await env.DB.prepare(
`SELECT *
FROM weekly
WHERE weekNumber = ?1`
)
.bind(weekNumber)
.first()
console.log('result', JSON.stringify(result))```js
// my code