Calling external APIs from Edge Functions
📖 Scenario: You are building a small cloud function that runs at the edge. This function will call an external API to get some data and then return it. Edge Functions run close to users for fast response.
🎯 Goal: Create an Edge Function in Supabase that calls the external API https://api.agify.io?name=michael to get the predicted age for the name 'michael'. You will set up the function, configure the API URL, fetch the data, and return the JSON response.
📋 What You'll Learn
Create a variable with the external API URL
Add a configuration variable for the name parameter
Write the fetch call to get data from the API
Return the JSON response from the Edge Function
💡 Why This Matters
🌍 Real World
Edge Functions are used to run code close to users for fast responses. Calling external APIs lets you enrich your functions with live data from other services.
💼 Career
Many cloud jobs require writing serverless functions that integrate with external APIs. This project teaches the basics of that important skill.
Progress0 / 4 steps