|
|
3 dias atrás | |
|---|---|---|
| .. | ||
| README.md | 3 dias atrás | |
| api.md | 3 dias atrás | |
| configuration.md | 3 dias atrás | |
| gotchas.md | 3 dias atrás | |
| patterns.md | 3 dias atrás | |
Cloudflare Workers Playground is a browser-based sandbox for instantly experimenting with, testing, and deploying Cloudflare Workers without authentication or setup. This skill provides patterns, APIs, and best practices specifically for Workers Playground development.
URL: workers.cloudflare.com/playground
Playground is NOT production-equivalent:
For production: Use wrangler CLI. Playground is for rapid prototyping.
Minimal Worker:
export default {
async fetch(request, env, ctx) {
return new Response('Hello World');
}
};
JSON API:
export default {
async fetch(request, env, ctx) {
const data = { message: 'Hello', timestamp: Date.now() };
return Response.json(data);
}
};
Proxy with modification:
export default {
async fetch(request, env, ctx) {
const response = await fetch('https://example.com');
const modified = new Response(response.body, response);
modified.headers.set('X-Custom-Header', 'added-by-worker');
return modified;
}
};
Import from CDN:
import { Hono } from 'https://esm.sh/hono@3';
export default {
async fetch(request) {
const app = new Hono();
app.get('/', (c) => c.text('Hello Hono!'));
return app.fetch(request);
}
};
No Setup Required:
Instant Preview:
Share & Deploy:
*.workers.dev subdomain immediately| Feature | Playground | Production (wrangler) |
|---|---|---|
| Language | JavaScript only | JS + TypeScript |
| Bindings | None | KV, D1, R2, DO, AI, etc. |
| Environment vars | None | Full support |
| Module format | ES only | ES + Service Worker |
| CPU time | 10ms (Free plan) | 10ms Free / 30s default, 5min max Paid |
| Custom domains | No | Yes |
| Analytics | No | Yes |