Reputation: 19488
Is there a way to access routes programmatically (without calling via http).
eg: (defroutes main-routes (POST "/query" "OK..."))
can I invoke a "query" function that the defroutes macro generated?
Upvotes: 1
Views: 289
Reputation: 33657
defroutes
creates a ring handler with the same name that you passed to it. So basically you have a ring handler i.e a simple function that takes a request map and returns a response map.
In your case you can call the function main-routes
by passing a proper ring request map object that have a uri
key such that it is being passed to "/query" handler function.
Upvotes: 1