Cloudflare Workers: ภาพรวม
เรียนรู้เกี่ยวกับ Cloudflare Workers ในฐานะแพลตฟอร์มไร้เซิร์ฟเวอร์สำหรับเผยแพร่โค้ดที่เอดจ์ ซึ่งอยู่ใกล้ผู้ใช้มากขึ้น
Cloudflare Workers: ภาพรวม เป็นบทเรียน Edge Computing with Cloudflare Workers & Deno ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Edge Computing with Cloudflare Workers & Deno และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Edge Computing with Cloudflare Workers & Deno มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Meet Cloudflare Workers
Cloudflare Workers is a serverless platform that runs your code on Cloudflare's global network — incredibly close to your users, wherever they are.
Serverless, but Closer
Like AWS Lambda, Workers are serverless — you write code, Cloudflare runs it with no servers to manage. The twist: it executes at the edge, near every user.
How Workers Intercept Requests
A Worker intercepts requests. Before a call hits your origin, it lands on a Cloudflare edge server where your code can modify, answer, or redirect it.
Why Choose Workers?
Workers are fast (code runs milliseconds from users), auto-scaling, cheap (pay per use), and global across hundreds of data centers. Ideal for modern apps.
Common Worker Use Cases
Workers shine for A/B testing, API gateways, content personalization, and on-the-fly image resizing — a lightweight backend or a boost to your existing one.
Workers Use JavaScript
Workers run standard JavaScript (or TypeScript) on the V8 engine — the same one behind Chrome and Node. Familiar syntax, familiar tools.
Anatomy of a Worker
A Worker listens for fetch events — incoming HTTP requests — and responds. This example just returns a plain Hello to any request.
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
// This Worker responds to ANY incoming request
return new Response('Hello from Cloudflare Worker!', {
headers: { 'content-type': 'text/plain' },
})
}The 'fetch' Event
addEventListener('fetch', ...) is your Worker's entry point: it runs your code on each incoming request, and event.respondWith() sends the reply back.
Worker Environment & APIs
Workers give you standard Web APIs like Fetch and URL, plus Cloudflare extras like KV storage and Durable Objects — coming in later lessons.
Check Your Understanding
Which of the following are key benefits of using Cloudflare Workers?
Workers Overview Recap
Recap: Cloudflare Workers run serverless code at the edge, intercepting requests with fast, scalable, cheap JavaScript. Next: setting up your dev environment.
คำถามที่พบบ่อย
บทเรียน “Cloudflare Workers: ภาพรวม” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “Cloudflare Workers: ภาพรวม” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Edge Computing with Cloudflare Workers & Deno ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Edge Computing with Cloudflare Workers & Deno มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “Cloudflare Workers: ภาพรวม”
เรียนรู้เกี่ยวกับ Cloudflare Workers ในฐานะแพลตฟอร์มไร้เซิร์ฟเวอร์สำหรับเผยแพร่โค้ดที่เอดจ์ ซึ่งอยู่ใกล้ผู้ใช้มากขึ้น คุณปฏิบัติ Edge Computing with Cloudflare Workers & Deno ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Edge Computing with Cloudflare Workers & Deno หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Edge Computing with Cloudflare Workers & Deno บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “Cloudflare Workers: ภาพรวม” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Edge Computing with Cloudflare Workers & Deno นี้ได้ไหม
ได้ บทเรียน Edge Computing with Cloudflare Workers & Deno ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- เอดจ์คอมพิวติงคืออะไร
- Cloudflare Workers: ภาพรวม
- Deno: รันไทม์สำหรับเอดจ์
- เอดจ์กับคลาวด์และ CDN