.. | ||
.gitignore | ||
.prettierrc.json | ||
README.md | ||
tsconfig.base.json |
Cloudflare Workers
Source code for our Cloudflare Workers.
Each worker is a self contained directory with its each package.json
.
Deploying
-
Switch to a worker directory, e.g.
cd health-check
. -
Install dependencies (if needed) with
yarn
-
Login into wrangler (if needed) using
yarn wrangler login
-
Deploy!
yarn wrangler publish
Wrangler is the CLI provided by Cloudflare to manage workers. Apart from
deploying, it also allows us to stream logs from running workers by using yarn wrangler tail
.
Creating a new worker
Copy paste an existing one. Unironically this is a good option because the
Cloudflare template has a lot of unnecessary noise, but if really do want to
create one from scratch, use npm create cloudflare@latest
.
To import an existing worker from the Cloudflare dashboard, use
npm create cloudflare@2 existing-worker-name -- --type pre-existing --existing-script existing-worker-name