chore: update docs.

This commit is contained in:
thorwebdev committed 2023-02-21 11:42:45 +08:00
1 parent 4dd6ab8f87
commit c4accb568f
6 files changed
+10 -10

No files matched your search

@@ -73,7 +73,7 @@ serve(async (_req) => {
```bash
supabase start
supabase functions serve upstash-redis-counter --no-verify-jwt --env-file supabase/functions/upstash-redis-counter/.env
supabase functions serve --no-verify-jwt --env-file supabase/functions/upstash-redis-counter/.env
```
Navigate to http://localhost:54321/functions/v1/upstash-redis-counter.
@@ -10,7 +10,7 @@ You can run your Edge Function locally using [`supabase functions serve`](/docs/
```bash
supabase start # start the supabase stack
supabase functions serve hello-world # start the Function watcher
supabase functions serve # start the Functions watcher
```
The `functions serve` command has hot-reloading capabilities. It will watch for any changes to your files and restart the Deno server.
@@ -20,7 +20,7 @@ The `functions serve` command has hot-reloading capabilities. It will watch for
While serving your local Edge Function, you can invoke it using curl:
```bash
curl --request POST 'http://localhost:54321/functions/v1/hello-world' \
curl --request POST 'http://localhost:54321/functions/v1/function-name' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs' \
--header 'Content-Type: application/json' \
--data '{ "name":"Functions" }'
@@ -37,7 +37,7 @@ const supabase = createClient(
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0'
)
const { data, error } = await supabase.functions.invoke('hello-world', {
const { data, error } = await supabase.functions.invoke('function-name', {
body: { name: 'Functions' },
})
```
+1 -1
View File
@@ -46,7 +46,7 @@ console.log(Deno.env.get('MY_NAME'))
Now we can invoke our function locally, by serving it with our new `.env.local` file:
```bash
supabase functions serve hello-world --env-file ./supabase/.env.local
supabase functions serve --env-file ./supabase/.env.local
```
When the function starts you should see the name “Yoda” output to the terminal.
+2 -2
View File
@@ -380,12 +380,12 @@ commands:
```
- id: supabase-functions-serve
title: supabase functions serve
summary: Serve a Function locally
summary: Serve Functions locally
tags: []
links: []
usage: |-
```sh
supabase functions serve <Function name> [flags]
supabase functions serve [flags]
```
subcommands: []
options: |-
+2 -2
View File
@@ -761,10 +761,10 @@ commands:
flags: []
- id: supabase-functions-serve
title: supabase functions serve
summary: Serve a Function locally
summary: Serve all functions locally
tags: []
links: []
usage: supabase functions serve <Function name> [flags]
usage: supabase functions serve [flags]
subcommands: []
flags:
- id: env-file
+1 -1
View File
@@ -239,7 +239,7 @@
},
{
"id": "supabase-functions-serve",
"title": "Serve a function",
"title": "Serve functions locally",
"slug": "supabase-functions-serve",
"type": "cli-command"
},