Skip to content

Commit

Permalink
External boot/console.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
tachibana-shin committed Aug 27, 2024
1 parent e1f9647 commit afc4ef5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Binary file modified bun.lockb
Binary file not shown.
4 changes: 3 additions & 1 deletion quasar.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
32 changes: 32 additions & 0 deletions supabase/functions/upsert_user/index.ts
Original file line number Diff line number Diff line change
@@ -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
/// <reference types="https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts" />

Check failure on line 6 in supabase/functions/upsert_user/index.ts

View workflow job for this annotation

GitHub Actions / Analyze (javascript)

Cannot find type definition file for 'https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts'.

Check failure on line 6 in supabase/functions/upsert_user/index.ts

View workflow job for this annotation

GitHub Actions / typing

Cannot find type definition file for 'https://esm.sh/@supabase/functions-js/src/edge-runtime.d.ts'.

console.log("Hello from Functions!")

Deno.serve(async (req) => {

Check failure on line 10 in supabase/functions/upsert_user/index.ts

View workflow job for this annotation

GitHub Actions / Analyze (javascript)

Cannot find name 'Deno'.

Check failure on line 10 in supabase/functions/upsert_user/index.ts

View workflow job for this annotation

GitHub Actions / Analyze (javascript)

Parameter 'req' implicitly has an 'any' type.

Check failure on line 10 in supabase/functions/upsert_user/index.ts

View workflow job for this annotation

GitHub Actions / typing

Cannot find name 'Deno'.

Check failure on line 10 in supabase/functions/upsert_user/index.ts

View workflow job for this annotation

GitHub Actions / typing

Parameter 'req' implicitly has an 'any' type.
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"}'
*/

0 comments on commit afc4ef5

Please sign in to comment.