How to build something triggerable by Railway cron

Currently I use cron-job.org to target a specific endpoint on an Express server I run. My understanding of Railway cron is that it would startup the entire service and therefore not work in the way I'm accustomed to. I'm not sure how to build a railway service that would do the same thing (be triggered by cron and successfully run) The endpoint just reads a 3rd party API and then puts stuff into a database. How could I convert this to work with Railway? I assume have a service that is just this code but how would I wrap it up such that it ran for Railway cron? (iife? or still express somehow?) Thanks!
Solution:
railway's cron jobs just redeploy your service, so just have your service do its job upon start and then exit when done
Jump to solution
6 Replies
Percy
Percy10mo ago
Project ID: ae96d841-f386-4064-9f46-9e5cfcee52ae
ThatsTasty
ThatsTasty10mo ago
ae96d841-f386-4064-9f46-9e5cfcee52ae
Solution
Brody
Brody10mo ago
railway's cron jobs just redeploy your service, so just have your service do its job upon start and then exit when done
Adam
Adam10mo ago
Not the move dude Agree with Brody here, there are packages for any language to run a given function on a cron schedule
ThatsTasty
ThatsTasty10mo ago
Thanks for the help. I played around and am using an IIFE that's successfully running on the cron.
Brody
Brody10mo ago
Awesome, glad to hear it