Skip to main content

Edge Function Guide

EasySite Edge Functions let you run small pieces of custom code on servers that turn your website features into APIs, allowing external tools to interact with your site and access backend data through simple prompts. They act as bridges to connect your website with external services like CRM systems and email marketing platforms, handle webhooks, synchronize data, and create custom API endpoints—essentially making your website "talk" to other tools without complex technical setup.

Step 1. Navigate to the Edge Functions tab from your Project

In your project panel, click the "Settings" button, then select "Edge Function" from the left-hand menu on the Settings page.

Step 2. Create your first Edge Function

Click the "+ Create Function" button at the top. On the new page, provide a function name and a short description, select "Anonymous Access" to skip authorization for this sample public API, and then click "Create Function." Your first Edge Function will now appear on this page.

Step 3. Customize your function to Access the public API

Click your Edge Function, then in the function panel, open the "Code Editor" tab and click the "AI Generate" button. A text box will appear where you can enter a prompt to access the public API.

In the prompt textbox, enter

Pleaes get Dallas weather

Click the "Generate Now" button to fetch data from a public weather API, then click "Update Function" to save your changes.

Step 4. Test your Edge Function

Return to your Edge Function Code Editor page and click the "Test" button to view the result.

A "Success" message will appear, and the Dallas weather information will be displayed in the message below.

Step 5. Get your function Endpoint and keys

Open your Edge Function, go to the "Basic Configuration" tab, and click "API Call Examples" A window will expand to display the function endpoint along with sample code in cURL, JavaScript, and Python.

To obtain an authorization API key, click the "Create API Key" button to generate YOUR_API_KEY.

Sample Edge Function for Accessing the Built-in Database

Step 1. Enable Database and Create the Sample Tables

The project has enabled the built-in database and created the Product and Order tables. For details on enabling the database please refer to Build In Database document

Step 2. Create "CheckBuildInDb" Edge Function

Following the steps in this guide to create "CheckBuildInDb" Edge Function

Please find Product that Ordered in August 2025 from Order table, list Product name, Order date and Amount

Click "Generate Now" to generate the Edge Function

Step 3. Run the "CheckBuildInDb" Edge Function to Retrieve Results from the Built-in Database

Go back to your Edge Function Code Editor page and click the "Test" button to see a success message and the correct result.