Files
classroomio/supabase/functions/notify/index.ts
T

21 lines
834 B
TypeScript
Raw Normal View History

2023-10-13 11:19:33 +01:00
// Follow this setup guide to integrate the Deno language server with your editor:
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
2023-11-25 21:56:02 +00:00
console.log('Hello from Functions!');
2023-10-13 11:19:33 +01:00
Deno.serve(async (req) => {
2023-11-25 21:56:02 +00:00
const { name } = await req.json();
2023-10-13 11:19:33 +01:00
const data = {
2023-11-25 21:56:02 +00:00
message: `Hello ${name}!`
};
2023-10-13 11:19:33 +01:00
2023-11-25 21:56:02 +00:00
return new Response(JSON.stringify(data), { headers: { 'Content-Type': 'application/json' } });
});
2023-10-13 11:19:33 +01:00
// To invoke:
// curl -i --location --request POST 'http://localhost:54321/functions/v1/' \
// --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' \
// --header 'Content-Type: application/json' \
// --data '{"name":"Functions"}'