To install wrangler, ensure you have npm installed, then run:
npm install -g @cloudflare/wrangler
wrangler --version
index.js
is the content of the Workers script.
wrangler preview --watch
This command will build your project, upload it to a unique URL, and open a tab in your browser to view it. This allows you to quickly test your project running on the actual Workers runtime, and optionally, even share it with others too.
We need to edit wrangler.toml
file and add our Cloudflare account_id
- more information about publishing your code can be found in the documentation.
Once you are ready, you can publish your code by running the following command:
wrangler publish