0Pricing
Supabase Backend as a Service · 강의

Edge Functions 입문

서버리스 함수의 개념과 Deno를 기반으로 구축된 Supabase Edge Functions가 백엔드 기능을 확장하는 방식을 이해합니다.

Edge Functions 입문은(는) CoddyKit의 무료 Supabase Backend as a Service 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Supabase Backend as a Service 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Supabase Backend as a Service 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Say Hello to Serverless!

Welcome to Supabase Edge Functions! Before we dive in, let's understand serverless functions. Traditionally, you'd manage servers to run your backend code.

With serverless, you write code, and a cloud provider handles all the server management for you. You just focus on your logic!

Why Go Serverless?

Serverless functions offer some powerful advantages:

  • Automatic Scaling: They scale up or down instantly with demand.
  • Pay-per-use: You only pay for the compute time your functions actually run.
  • Reduced Ops: No servers to provision, patch, or maintain.
  • Faster Development: Focus purely on writing your application logic.

Supabase's Serverless Power

Supabase offers its own brand of serverless functions called Edge Functions. They extend your Supabase project's capabilities without needing to set up a separate server.

Think of them as tiny pieces of backend logic that run on demand, close to your users.

Powered by Deno

Supabase Edge Functions are built on Deno, a secure runtime for JavaScript and TypeScript. Deno is a modern alternative to Node.js.

This means you can write your functions in TypeScript right out of the box, enjoying type safety and modern JavaScript features without complex setup.

How Edge Functions Work

Edge Functions are event-driven. They only execute when triggered by an event, like an HTTP request from your application or a webhook.

They are also stateless, meaning each execution is independent. This design helps them scale efficiently.

What Can They Do?

Edge Functions are incredibly versatile! Here are some common use cases:

  • Custom API Endpoints: Build your own API routes.
  • Webhook Handlers: Process events from other services.
  • Data Transformations: Modify data before or after database operations.
  • Backend Logic: Run complex calculations or integrate with external APIs.

A Simple 'Hello' Function

Let's look at a basic Edge Function. This Deno code defines a function that responds to an HTTP request, expecting a name in its body.

Try running it to see the simple JSON response!

Deno.serve(async (req) => {
  const { name } = await req.json();

  return new Response(
    JSON.stringify({ message: `Hello, ${name || 'World'}!` }),
    {
      headers: { 'Content-Type': 'application/json' },
      status: 200,
    },
  );
});

The Power of the 'Edge'

The 'Edge' in Edge Functions means they run geographically close to your users. This significantly reduces latency, making your applications feel faster and more responsive.

Supabase handles deploying your functions to a global network of servers for optimal performance.

Invoking Your Function

Once deployed, you can easily call your Edge Functions from your client-side application using the Supabase client library. Here's a JavaScript example for our 'hello-world' function:

import { createClient } from '@supabase/supabase-js';

// Replace with your actual Supabase project URL and Anon Key
const supabaseUrl = 'https://your-project-ref.supabase.co';
const supabaseAnonKey = 'YOUR_ANON_KEY';

const supabase = createClient(supabaseUrl, supabaseAnonKey);

async function callHelloFunction() {
  const { data, error } = await supabase.functions.invoke('hello-world', {
    body: { name: 'CoddyKit User' },
  });

  if (error) {
    console.error('Error invoking function:', error);
  } else {
    console.log('Function response:', data);
  }
}

callHelloFunction();

Edge Function Essentials

Let's check your understanding of Supabase Edge Functions!

Recap: Edge Functions Intro

Great job! You've learned the basics of serverless computing and Supabase Edge Functions.

  • Edge Functions are Supabase's serverless offering.
  • They run on the Deno runtime, supporting TypeScript.
  • They offer automatic scaling, pay-per-use, and reduced ops.
  • They execute on demand, close to your users.

Next, we'll learn how to deploy your first function!

자주 묻는 질문

“Edge Functions 입문” 강의는 무료인가요?

네 — “Edge Functions 입문” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Supabase Backend as a Service 강의 전체를 잠금 해제할 수 있습니다. Supabase Backend as a Service 강의에는 총 4개의 강의가 포함되어 있습니다.

“Edge Functions 입문”에서 뭘 배우나요?

서버리스 함수의 개념과 Deno를 기반으로 구축된 Supabase Edge Functions가 백엔드 기능을 확장하는 방식을 이해합니다. 브라우저에서 직접 실행하는 실습 코드로 Supabase Backend as a Service을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Supabase Backend as a Service을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Supabase Backend as a Service은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.

“Edge Functions 입문” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Supabase Backend as a Service 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Supabase Backend as a Service 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. Edge Functions 입문
  2. 첫 함수 배포하기
  3. 애플리케이션에 함수 통합하기
  4. 비밀, 환경 변수 및 예약 함수
← Supabase Backend as a Service(으)로 돌아가기