Playground/Cloudflare Workers

Cloudflare WorkersServerless JS at the edge

cloudflare-workers
Write a fetch handler, PUT it to the API, get a live URL in seconds.

Deploy a worker, live

Ready

This will write a real Worker on Cloudflare's edge under the name playground-hello. Edit the greeting, hit deploy, and your worker URL will appear below. Deploy is fast — usually a couple seconds.

Show the worker source (14 lines)
export default {
  async fetch(request) {
    const url = new URL(request.url);
    if (url.pathname === "/json") {
      return Response.json({
        message: "Hello from a Cohesivity Worker!",
        deployed_at: new Date().toISOString()
      });
    }
    return new Response("Hello from a Cohesivity Worker!", {
      headers: { "content-type": "text/plain" }
    });
  }
};

The actual calls

Create the worker (idempotent):
POST/api/workers
{
  "name": "playground-hello"
}
Push code:
PUT/api/workers/playground-hello
{
  "code": "export default { async fetch(request) { … } };"
}
Use cron to schedule recurring runs. ES module syntax — export default.