new-worker.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Welcome to Cloudflare Workers! This is your first worker.
  3. *
  4. * - Run `wrangler dev src/index.ts` in your terminal to start a development server
  5. * - Open a browser tab at http://localhost:8787/ to see your worker in action
  6. * - Run `wrangler deploy src/index.ts --name my-worker` to deploy your worker
  7. *
  8. * Learn more at https://developers.cloudflare.com/workers/
  9. */
  10. export interface Env {
  11. // Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
  12. // MY_KV_NAMESPACE: KVNamespace;
  13. //
  14. // Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
  15. // MY_DURABLE_OBJECT: DurableObjectNamespace;
  16. //
  17. // Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
  18. // MY_BUCKET: R2Bucket;
  19. //
  20. // Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/
  21. // MY_SERVICE: Fetcher;
  22. }
  23. export default {
  24. async fetch(
  25. request: Request,
  26. env: Env,
  27. ctx: ExecutionContext
  28. ): Promise<Response> {
  29. return new Response("Hello World!");
  30. },
  31. };