fetch
Examples of making fetch requests from within your Worker script including generating JSON post requests then reading in the resulting response body, aggregating multiple requests into one response, and following/catching redirects.
index.js
is the content of the Workers script.
Live Demos are hosted on workers-tooling.cf/demos/fetch
:
Demo JSON | Demo HTML
Wrangler
To generate using wrangler
wrangler generate myApp https://github.com/cloudflare/worker-template-fetch
Serverless
To deploy using serverless add a serverless.yml
file.