new-worker-scheduled.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Welcome to Cloudflare Workers! This is your first scheduled worker.
  3. *
  4. * - Run `wrangler dev --local` in your terminal to start a development server
  5. * - Run `curl "http://localhost:8787/cdn-cgi/mf/scheduled"` to trigger the scheduled event
  6. * - Go back to the console to see what your worker has logged
  7. * - Update the Cron trigger in wrangler.toml (see https://developers.cloudflare.com/workers/wrangler/configuration/#triggers)
  8. * - Run `wrangler deploy --name my-worker` to deploy your worker
  9. *
  10. * Learn more at https://developers.cloudflare.com/workers/runtime-apis/scheduled-event/
  11. */
  12. export interface Env {
  13. // Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
  14. // MY_KV_NAMESPACE: KVNamespace;
  15. //
  16. // Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
  17. // MY_DURABLE_OBJECT: DurableObjectNamespace;
  18. //
  19. // Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
  20. // MY_BUCKET: R2Bucket;
  21. }
  22. export default {
  23. async scheduled(
  24. controller: ScheduledController,
  25. env: Env,
  26. ctx: ExecutionContext
  27. ): Promise<void> {
  28. console.log(`Hello World!`);
  29. },
  30. };