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
npx wrangler loginCreate Cloudflare Worker
npx wrangler init supabase-at-the-edgeRun wrangler development server
npx wrangler dev