Skip to main content

Supabase Edge functions Integration

Explore how to import Supabase Edge functions with your EasySite application.

What is supabase edge functions ?

Edge Functions are server-side TypeScript functions, distributed globally at the edge—close to your users.

How to create edge function?

Example of using Edge function in Easysite

In the example, I store a string of secret keys in supabase and get the secret keys by calling getkey function. In actual situations, you can store any data that needs to be kept confidential in supabase and then get it through function.

Step 1 - Create a Project

  1. Open EasySite.
  2. Enter your dream idea in the text box

For example:

Create a hello world website

  1. Click "Generate my website".

Step 2 - Get secret keys safely

You can either:

Add a get key button to homepage, click the button to call getkey interface, and display the response result.
getkey interface definition:
url: https://bmvqdtjwfnhdaadunesa.supabase.co/functions/v1/getkey
header: {"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJtdnFkdGp3Zm5oZGFhZHVuZXNhIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDI5NTM5NTEsImV4cCI6MjA1ODUyOTk1MX0.vzgKmfG1c3tclep95Pz_CtC5xQQTPDF_SQdgotzVKGw"}
Response content: { "key": "xxxx" }

Results display: