File tree 3 files changed +33
-15
lines changed
3 files changed +33
-15
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ export interface Env {
2
+ // If you set another name in wrangler.toml as the value for 'binding',
3
+ // replace "DB" with the variable name you defined.
4
+ DB : D1Database
5
+ }
6
+
7
+ export async function onRequest ( context ) {
8
+ // If you did not use `DB` as your binding name, change it here
9
+ const { results } = await context . env . DB . prepare (
10
+ 'SELECT * FROM Customers WHERE CompanyName = ?' ,
11
+ )
12
+ . bind ( 'Bs Beverages' )
13
+ . all ( )
14
+
15
+ return Response . json ( results )
16
+ // console.log('json', await context.request.json())
17
+
18
+ // const data = {
19
+ // hello: 'world',
20
+ // }
21
+
22
+ // const json = JSON.stringify(data, null, 2)
23
+
24
+ // return new Response(json, {
25
+ // headers: {
26
+ // 'content-type': 'application/json;charset=UTF-8',
27
+ // },
28
+ // })
29
+ }
Original file line number Diff line number Diff line change
1
+ [[d1_databases ]]
2
+ binding = " DB"
3
+ database_name = " prod-d1-play"
4
+ database_id = " 070c90e5-b671-4854-aaa7-b122c535b8c5"
You can’t perform that action at this time.
0 commit comments