121820

Trending topics of the internet explained.

← Back to all articles
Technology

Getting Started with Cloudflare Workers

Cloudflare Workers let you run code on a global network of data centers, close to your users. Instead of routing requests to a single origin server, your script runs at the edge.

Why the edge?

Latency is a feature. When your code runs near the user, pages load faster and APIs respond sooner. Workers run in hundreds of Cloudflare locations worldwide.

Your first worker

A Workers script is just an ES module exporting a fetch handler:

export default {
  async fetch(request) {
    return new Response("Hello World!");
  },
};

Deploy it with wrangler deploy and you get a URL on workers.dev immediately.

What to build next

The best way to learn is to ship something small and iterate.

Share: 𝕏 R in

More in Technology