You can now create a CRON task in your external service, pointing to your api route with the appropriate Authorization header :
You can now create a CRON task in your external service, pointing to your api route with the appropriate Authorization header :
Set up an api route that validates the token and triggers the task:
Set up an api route that validates the token and triggers the task:
Add a token as an environment variable (e.g. NUXT_CRON_TOKEN) and in your Runtime Config.
Then create a small utility function to ensure only authorized requests can trigger tasks:
Add a token as an environment variable (e.g. NUXT_CRON_TOKEN) and in your Runtime Config.
Then create a small utility function to ensure only authorized requests can trigger tasks:
For example, a task that sends weekly emails:
For example, a task that sends weekly emails: