0Pricing
Edge Computing with Cloudflare Workers & Deno · 강의

Workers Sites 및 Pages

Workers Sites와 Pages를 사용하여 정적 사이트와 단일 페이지 애플리케이션을 Cloudflare의 엣지에 직접 호스팅합니다.

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

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

Host Static Sites at the Edge

Welcome! In this lesson, we'll explore how to host your static websites and Single Page Applications (SPAs) directly on Cloudflare's global network edge.

This means your site's content is served from locations physically closer to your users, leading to incredibly fast load times and a smoother experience.

Introducing Workers Sites

Cloudflare Workers Sites is a feature that allows you to deploy static assets, like HTML, CSS, JavaScript, and images, directly to the Cloudflare edge using the Wrangler CLI.

  • It's perfect for simple static websites.
  • It works great for Single Page Applications (SPAs) built with frameworks like React, Vue, or Svelte.
  • You get the power of Workers to add dynamic logic if needed.

Benefits of Edge Hosting

Hosting your content at the edge offers several key advantages:

  • Blazing Fast Performance: Content is served from the nearest data center.
  • Global Reach: Your site is available worldwide with low latency.
  • Built-in Security: Leverages Cloudflare's network for DDoS protection and WAF.
  • Automatic SSL: Free, managed SSL certificates for secure connections.

Your First Workers Site HTML

Let's create a super simple index.html file. This will be the main page for our Workers Site.

Create a new folder (e.g., my-static-site) and put this file inside it:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Hello Edge!</title>
  <style>
    body { font-family: sans-serif; text-align: center; margin-top: 50px; }
  </style>
</head>
<body>
  <h1>Welcome to the Edge!</h1>
  <p>This site is hosted by Cloudflare Workers.</p>
</body>
</html>

Deploying a Workers Site

To deploy your static site, you'll use the Wrangler CLI. First, make sure you have Wrangler installed and configured.

Navigate to your project directory (e.g., my-static-site) and use the wrangler pages deploy command. This command helps deploy your static assets.

wrangler pages deploy ./ --project-name my-edge-app

# Or, if you have a build step:
# npm run build && wrangler pages deploy ./dist --project-name my-edge-app

Introducing Cloudflare Pages

While Workers Sites are great for quick deployments, Cloudflare Pages offers a more comprehensive platform for JAMstack and full-stack applications.

Pages integrates directly with your Git repository (GitHub, GitLab), providing automatic build and deploy pipelines.

Pages Features: CI/CD & Previews

Cloudflare Pages streamlines your development workflow:

  • Git Integration: Connects to your repo for automatic deployments on push.
  • Build Pipelines: Automatically builds your frontend framework (React, Vue, Next.js, etc.).
  • Preview Deployments: Every pull request gets a unique preview URL.
  • Custom Domains: Easily link your own domain.

Workers Sites vs. Pages: Key Differences

Both host static content at the edge, but serve different needs:

  • Workers Sites: Simpler, manual deployments via Wrangler CLI. Good for basic static sites or when you want more control over the Worker script logic.
  • Cloudflare Pages: Full-fledged CI/CD platform, Git-integrated, automatic builds, preview deployments. Ideal for modern JAMstack sites and SPAs.

SPAs and Client-Side Routing

Workers Sites and Pages are perfect for Single Page Applications (SPAs). SPAs often use client-side routing, meaning the server always serves the same index.html, and JavaScript handles navigation.

Cloudflare Pages handles this automatically. For Workers Sites, you might need a small Worker script to ensure all paths fall back to index.html.

Test Your Knowledge

You've learned about two powerful ways to host your web applications at the edge. Let's see if you can distinguish between them.

Recap: Edge Hosting for Web Apps

In this lesson, we explored how Cloudflare empowers you to host static sites and SPAs at the edge. We covered:

  • Workers Sites: For simple static deployments via Wrangler.
  • Cloudflare Pages: A full-featured platform with Git integration and CI/CD for JAMstack apps.
  • The incredible benefits of edge hosting, like speed and global reach.

Hosting at the edge brings your content closer to users, ensuring a fast, secure, and highly available web experience.

자주 묻는 질문

“Workers Sites 및 Pages” 강의는 무료인가요?

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

“Workers Sites 및 Pages”에서 뭘 배우나요?

Workers Sites와 Pages를 사용하여 정적 사이트와 단일 페이지 애플리케이션을 Cloudflare의 엣지에 직접 호스팅합니다. 브라우저에서 직접 실행하는 실습 코드로 Edge Computing with Cloudflare Workers & Deno을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Edge Computing with Cloudflare Workers & Deno을(를) 시작하는 데 경험이 필요한가요?

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

“Workers Sites 및 Pages” 강의는 얼마나 걸리나요?

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

이 Edge Computing with Cloudflare Workers & Deno 강의에서 코드를 작성하고 실행할 수 있나요?

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

이 강의의 모든 강의

  1. Workers Sites 및 Pages
  2. 프런트엔드 프레임워크 통합
  3. Deno를 활용한 데이터베이스 프록시
  4. 엣지에서의 서버 측 렌더링
← Edge Computing with Cloudflare Workers & Deno(으)로 돌아가기