netzo / fresh-netzo

Full-stack Deno Fresh meta-framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
https://netzo.io
MIT License
52 stars 2 forks source link

[modules] add `crons` module #50

Closed miguelrk closed 10 months ago

miguelrk commented 12 months ago

Add a crons module to schedule HTTP requests:

// netzo.config.ts
export default defineNetzoConfig({
  modules: {
    crons: {
      // ...
      crons: [
        {
          request: "/api/every-minute", // [internal] (defaults to GET /api/every-minute)
          schedule: "* * * * *"
        },
        {
          url: "https://api.example.com/every-hour", // [external] via absolute URL
          schedule: "0 * * * *"
        },
        {
          request: (options) => ({ method, url: "/api/every-day", headers, body }) // [getter] create request dynamically
          schedule: "0 0 * * *",
        }
      ]
  }
})
miguelrk commented 10 months ago

Closing as no longer relevant since Deno.cron has landed