Course lesson

Create a Cloudflare Worker with the Wrangler CLI

Cloudflare Workers are serverless functions that run at the Edge! πŸ”ͺ

Duration
2 min
Access
Free
Transcript
Retained from source evidence

Cloudflare Workers are serverless functions that run at the Edge! πŸ”ͺ

The Wrangler CLI is a tool for interfacing with your Cloudflare account, and creating or publishing your Workers.

In this video, we use the Wrangler CLI to log in to our Cloudflare account and authorize the wrangler command to make changes on our behalf.

Additionally, we create a worker and host it locally with the npx wrangler dev command. We then demonstrate making a GET request to our Cloudflare Worker from the browser, and confirm it is sending the correct response.

By modifying the response locally, we can see that changes are reflected any time we refresh the browser.

Code Snippets

Login to Cloudflare with Wrangler CLI

Terminal
npx wrangler login

Create Cloudflare Worker

Terminal
npx wrangler init supabase-at-the-edge

Run wrangler development server

Terminal
npx wrangler dev

Resources