Skip to content

Commit 081a753

Browse files
committed
Add example functions
1 parent 497c412 commit 081a753

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,4 @@ iOSInjectionProject/
9696
/.swiftpm
9797

9898
Secrets.swift
99+
.env
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
import { serve } from "https://deno.land/[email protected]/http/server.ts"
6+
7+
console.log("Hello from Functions!")
8+
9+
serve(async (req) => {
10+
const { name } = await req.json()
11+
const data = {
12+
message: `Hello ${name}!`,
13+
}
14+
15+
return new Response(
16+
JSON.stringify(data),
17+
{ headers: { "Content-Type": "application/json" } },
18+
)
19+
})
20+
21+
// To invoke:
22+
// curl -i --location --request POST 'http://localhost:54321/functions/v1/' \
23+
// --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' \
24+
// --header 'Content-Type: application/json' \
25+
// --data '{"name":"Functions"}'

0 commit comments

Comments
 (0)