Skip to content

Commit eb6a001

Browse files
authored
updated edge functions documentation (#99)
1 parent 83d15eb commit eb6a001

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

sqlite-cloud/platform/edge-functions.mdx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Turning on linearizable reads ensures strong consistency, but may introduce some
1616

1717
## Getting Started
1818
1. Navigate to the Edge Functions page from your dashboard.
19-
1. Under "Development", select "Edge Function", then click the "Create" button.
20-
1. Write and test your function.
19+
2. Under "Development", select "Edge Function", then click the "Create" button.
20+
3. Write and test your function.
2121
1. Select the database you want to access and an API key if necessary
2222
2. When you're finished, click deploy.
2323

@@ -31,6 +31,24 @@ return {
3131
}
3232
```
3333

34+
### Authorization
35+
Edge functions that access your SQLite databases must be authorized via API key. You can automatically authorize an edge function on every call by assigning it an API key via the "API KEY" dropdown.
36+
37+
If no API key is assigned, an API key must be sent in the request url as a query parameter (`?apikey=YOUR_API_KEY`) or as an attribute in the request body (`{ apikey: YOUR_API_KEY }`).
38+
39+
### Execution
40+
41+
Edge functions can be called via HTTP GET and POST methods. You can pass additional values to your edge function in two ways:
42+
- Query parameters: Accessible via `request.params`
43+
- Request body: Accessible via `request.data`
44+
45+
### Testing
46+
You may test the execution of edge functions by clicking the "Test" command.
47+
48+
You are not required to supply an API key when testing your edge function in the console. The function will run using the dashboard user privileges.
49+
50+
51+
3452
## Guides
3553
### Interacting with your Database
3654
Use the global `connection` object to access and manipulate your database.

0 commit comments

Comments
 (0)