🌤 deploy-worker
Easiest way to compile
and deploy Cloudflare Workers.
deploy-worker --zone-id {zone-id} worker.js
Installation
Install with npm:
npm install --global deploy-worker
Or yarn:
yarn global add deploy-worker
Authentication
You need to pass in CF_EMAIL
and CF_AUTH_Key
as environment variables and then you can set CF_ZONE_ID
/--zone-id
and optionally CF_ACCOUNT_ID
/--acount-id
if you're an Enterprise customer.
Usage
Create a package.json
to install modules you're using:
"dependencies": "node-emoji": "^1.1.0" "qs": "^6.7.0"
Then create your .js
or .ts
file, like worker.js
:
Make sure your dependencies are installed, then run deploy-worker
like this:
deploy-worker --zone-id {zone-id} worker.js
Congrats! You've deployed a Cloudflare Worker 🎉