Skip to content

Commit a85ccae

Browse files
committed
Updating the example code to be accurate.
1 parent 18cba31 commit a85ccae

File tree

1 file changed

+6
-5
lines changed
  • src/content/docs/workers/testing/miniflare/storage

1 file changed

+6
-5
lines changed

src/content/docs/workers/testing/miniflare/storage/d1.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Specify D1 Databases to add to your environment as follows:
1111

1212
```js
1313
const mf = new Miniflare({
14-
d1Databases: {
15-
DB: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
16-
},
14+
"d1Databases":{
15+
"DB":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
16+
}
1717
});
1818
```
1919

@@ -24,7 +24,8 @@ bound to a Worker. You can do this with the `getD1Database` method:
2424

2525
```js
2626
const db = await mf.getD1Database("DB");
27-
const { results } = await db.prepare("<Query>");
27+
const stmt = await db.prepare("<Query>");
28+
const returnValue = await stmt.run();
2829

29-
console.log(await res.json(results));
30+
return Response.json(returnValue.results);
3031
```

0 commit comments

Comments
 (0)