Cron and HTTP and HTTP Request #577
-
Since we can combine both cron and HTTP triggers in the same deta micro. I'm wonder how to use cron to trigger / simulate a http visit to my deta micro server. My micro service takes a long time and would normally take me several attempts to make it through, so I build a caching mechanism and hope my cron can hit my such micro service to update the cache periodically. Is it possible? Else I might have to write my own http request parser to do it. thx Update, let's get into details since it is possible. Giving the following app:
How to call |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
You are able to call your HTTP route handlers from your cron function. Or if you feel like dipping your toes in the dark side of the pool, you can "simulate" an HTTP request to your Micro by using |
Beta Was this translation helpful? Give feedback.
-
您的邮件已经收到,谢谢!
|
Beta Was this translation helpful? Give feedback.
You are able to call your HTTP route handlers from your cron function. Or if you feel like dipping your toes in the dark side of the pool, you can "simulate" an HTTP request to your Micro by using
fetch()
(JS),requests
(Python), or any other way of sending HTTP requests, and sending a GET request to the chosen route, using theDETA_PATH
env var to get the subdomain.