From afc4ef522431118d872a4b78f1443a4c0624d871 Mon Sep 17 00:00:00 2001 From: Tachibana Shin Date: Wed, 28 Aug 2024 02:44:00 +0700 Subject: [PATCH] External boot/console.ts --- bun.lockb | Bin 618162 -> 618162 bytes quasar.config.ts | 4 ++- supabase/functions/upsert_user/index.ts | 32 ++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 supabase/functions/upsert_user/index.ts diff --git a/bun.lockb b/bun.lockb index 2051404dd05e1b1cbd11a475c7c856efb5fbd4cf..dc7b5a4bd6bd0ef7e012217583a18cbbc30cd17c 100755 GIT binary patch delta 47 zcmdmVS9Q}})rJF7M2#)Eo_2u?2K{7dPaJN?GkZpK+F!r9NQ)0IA;j}0D8O) A`2YX_ delta 47 zcmdmVS9Q}})rJF7M2#)Eo_2u>`Xa{C8@7c AHvj+t diff --git a/quasar.config.ts b/quasar.config.ts index 9dd8f330..73415b4b 100644 --- a/quasar.config.ts +++ b/quasar.config.ts @@ -198,7 +198,9 @@ export default configure(function (/* ctx */) { } ], // ["vite-plugin-rewrite-all", {}], - ["vite-plugin-remove-console", {}], + ["vite-plugin-remove-console", { + external: ["src/boot/console.ts"] + }], [vitePluginI18nLangs, {}] ] as unknown as any }, diff --git a/supabase/functions/upsert_user/index.ts b/supabase/functions/upsert_user/index.ts new file mode 100644 index 00000000..2e10cc55 --- /dev/null +++ b/supabase/functions/upsert_user/index.ts @@ -0,0 +1,32 @@ +// 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. + +// Setup type definitions for built-in Supabase Runtime APIs +/// + +console.log("Hello from Functions!") + +Deno.serve(async (req) => { + const { name } = await req.json() + const data = { + message: `Hello ${name}!`, + } + + return new Response( + JSON.stringify(data), + { headers: { "Content-Type": "application/json" } }, + ) +}) + +/* To invoke locally: + + 1. Run `supabase start` (see: https://supabase.com/docs/reference/cli/supabase-start) + 2. Make an HTTP request: + + curl -i --location --request POST 'http://127.0.0.1:54321/functions/v1/upsert_user' \ + --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' \ + --header 'Content-Type: application/json' \ + --data '{"name":"Functions"}' + +*/