https://kotlinlang.org logo
#ktor
Title
# ktor
s

Stephen Vinouze

01/20/2023, 12:05 PM
I’d like to call one of my route from my ktor server (triggered by a Job). How should I proceed? Do I need to make a request using the ktor client?
a

Aleksei Tirman [JB]

01/20/2023, 12:18 PM
Could you please explain what you mean by calling a route?
s

Stephen Vinouze

01/20/2023, 12:32 PM
It's an endpoint I've declared in my ktor backend. I've set up a scheduler pattern with quartz and I'd like to call this endpoint when the job gets triggered.
a

Aleksei Tirman [JB]

01/20/2023, 1:51 PM
You can make a request using an HTTP client or extract the code from the route’s handler to a function and call it.
👍 1
s

Stephen Vinouze

01/20/2023, 2:10 PM
I was also considering extracting the code in the route. Thanks for confirming for using the client! (I get a bit confused between the server and the client frameworks)