Robin Simonklein
banner
robinsimonklein.dev
Robin Simonklein
@robinsimonklein.dev
#Nuxt enthusiast 💚, side-project addict. Some projects finish, some… well, they’ll get there. ✨
🤡
September 30, 2025 at 7:13 AM
😴
April 19, 2025 at 7:13 PM
4/6 - Trigger your route with CRON

You can now create a CRON task in your external service, pointing to your api route with the appropriate Authorization header :
November 17, 2024 at 4:29 PM
3/6 - Create a POST route

Set up an api route that validates the token and triggers the task:
November 17, 2024 at 4:29 PM
2/6 - Secure your CRON calls

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:
November 17, 2024 at 4:29 PM
1/6 - Define a Nitro task

For example, a task that sends weekly emails:
November 17, 2024 at 4:29 PM
This made me lose 3 hours 🥲
November 8, 2024 at 11:53 AM