

Cloudflare Workers Recipe Exchange
source link: https://www.tuicool.com/articles/hit/ANBJVbZ
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Photo of Indian Spices
, by Joe mon bkk. Wikimedia Commons
, CC BY-SA 4.0
.
Share yourCloudflare Workers recipes with theCloudflare Community. Developers in Cloudflare’s community each bring a unique perspective that would yield use cases our core team could never have imagined. That is why we invite you to share Workers recipes that are useful in your own work, life, or hobby.
We’ve created a new tag“Recipe Exchange” in the Workers section of the Cloudflare Community Forum . We invite you to share your work, borrow / get inspired by the work of others, and upvote useful recipes written by others in the community.
Recipe Exchange in Cloudflare Community
We will be highlighting select interesting and/or popular recipes (with author permission) in the coming months right here in this blog.
What is Cloudflare Workers, anyway?
Cloudflare Workers let you run JavaScript in Cloudflare’s hundreds of data centers around the world. Using a Worker, you can modify your site’s HTTP requests and responses, make parallel requests, or generate responses from the edge. Cloudflare Workers has been in open beta phase since February 1st. Read more about the launch inthis blog post.
What can you do with Cloudflare Workers?
Cloudflare has an incredibly powerful global network of 151 data centers, where you can put compute anywhere and you can write with a language you’re familiar with (JavaScript) with a standard API you're familiar with ( Service Workers ). You can move your compute to be super low latency, to be much nearer to your end user, your database, your embedded device, or anything else you want faster round trips for.
You may access and leverage the power of Cloudflare’s network for your next applications or as an add-on for optimizing the performance of your existing projects by running JavaScript on Cloudflare’s edge network.
Thenext product that leverages Cloudflare's infrastructure to create security, performance, usability, and other optimizations for the Internet should have the lowest possible barriers to entry. Millions of customers should have access to those products on day one. That's how the Internet should work.
Cloudflare's Developer Platform.See More≫
For inspiration, the Workers core team baked upsome recipes to highlight a few popular use cases :
- A/B Testing You can create a Cloudflare Worker to control A/B tests.
- Aggregating Multiple Requests Here, we make multiple requests to different API endpoints, aggregate the responses and send it back as a single response.
- Conditional Routing The easiest way to deliver different content based on the device being used is to rewrite the URL of the request based on the condition you care about.
- Custom responses that don't hit origin servers You can return responses directly from the edge. No need to hit your origin.
- Hot-link Protection You can use Cloudflare Workers to protect your hot-links on your web properties.
- Post Requests Reading content from an HTTP POST request
- Random Content Cookies You can create random content cookies using Cloudflare Workers.
- Signed Requests A common URL authentication method known as request signing1 can be implemented in a worker with the help of the Web Crypto API.
- Streaming Responses Minimize the visitor’s time-to-first-byte and the amount of buffering done in the worker script.
What if I want to just offer an idea or a use case?
That’s great! I’ve createdthis thread in the Cloudflare Community forum so anyone can submit a recipe idea, comment on one, and anyone can volunteer to write a recipe that there is a ready audience for.
Recommend
-
62
A few months ago we released a new way for people to run serverless Javascript called Cloudflare Workers. We believe Workers is the fastest way to execute serverless functions. If it is truely the fastest, and it...
-
69
Hello! For the last 6 months, I’ve had a problem on this blog where every so often a page would show up like this: Instead of...
-
45
We just announced ten major new products and initiatives overCrypto W...
-
114
README.md Cloudflare Workers WebAssembly Demo This repository implements image resizing that runs on Cloudflare's edge network using
-
74
We just announced ten major new products and initiatives over Crypto Week and Birthday Week, but our work is never finished. We're continuously upgrading our existing products with new functionality. Today, we're...
-
40
Serverless is the new black. I mean everybody I know is moving to the serverless platforms or launching one. OK, maybe not everyone but Cloudflare is definitely moving in this direction with an audacious relatively new p...
-
53
This is a guest post by Igor Krestov and Dan Taylor. Igor is a lead software developer at SALT.agency, and Dan a lead technical SEO consultant, and has also been credited with coining the term “edge SEO”. SALT.ag...
-
28
A few weeks ago,Scotch.io gave me the push to experiment with Cloudflare Workers and Vue server-side re...
-
9
We initially launchedCloudflare Workers with support for JavaScript and languages that compile to WebAssembly, such as Rust, C, and C++. Since the...
-
6
Please wait... We are checking your browser... blog.cloudflare.com What can I do to prevent this i...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK