This repository was archived by the owner on Jul 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
supabase/functions/generate-weather-suggestions Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Follow this setup guide to integrate the Deno language server with your editor:
2
+ // https://deno.land/manual/getting_started/setup_your_environment
3
+ // This enables autocomplete, go to definition, etc.
4
+
5
+ // Setup type definitions for built-in Supabase Runtime APIs
6
+ import "jsr:@supabase/functions-js/edge-runtime.d.ts"
7
+
8
+ console . log ( "Hello from Functions!" )
9
+
10
+ Deno . serve ( async ( req ) => {
11
+ // get supabase user from request
12
+ const user = req . supabase . auth . user ( )
13
+
14
+ // get request payload
15
+ const body = await req . json ( )
16
+
17
+ // return a response
18
+
19
+
20
+ return new Response (
21
+ JSON . stringify ( data ) ,
22
+ { headers : { "Content-Type" : "application/json" } } ,
23
+ )
24
+ } )
25
+
26
+ /* To invoke locally:
27
+
28
+ 1. Run `supabase start` (see: https://supabase.com/docs/reference/cli/supabase-start)
29
+ 2. Make an HTTP request:
30
+
31
+ curl -i --location --request POST 'http://127.0.0.1:54321/functions/v1/generate-weather-suggestions' \
32
+ --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' \
33
+ --header 'Content-Type: application/json' \
34
+ --data '{"name":"Functions"}'
35
+
36
+ */
You can’t perform that action at this time.
0 commit comments