Fork me on GitHub

Question: In an edn file, how can use a function from another file (from the same project)?

Shantanu Kumar16:11:38

@amarjeet Can you give an example?


So, I created a vase app (lein new vase my-app) - here: . Vase does all the routing inside the edn file under the resources folder of the app. Now, I want to hit a 3rd party API. I want to use Exotel's cloud telephony API here. This, I believe, I can do inside the service.clj file only, using clj-http.client. If I do that, how to use the return values inside my api routes, which are in the end file?


*api routes, which are in the EDN file

Shantanu Kumar17:11:18

I’m not familiar with Pedestal/Vase, but I’m puzzled why would you write any code in the EDN file. How do you get the stack trace for the code in such EDN files?


Vase seems to be enforcing this approach. Route definition in pedestal is in the services.clj file only. Its just vase. And, routes defined inside the edn file are overriding the ones defined in the services.clj file in the vase app.

Shantanu Kumar17:11:06

@amarjeet If you look in the EDN file, there are forms starting with #vase/respond and #vase/transact etc. — those are reader literals

Shantanu Kumar17:11:33

for in-depth info on reader literals, you can start here —*data-readers*

Shantanu Kumar17:11:18

Vase provides some reader literals, which is like a DSL in this case — you need to lookup Vase documentation for details on that DSL

Shantanu Kumar17:11:01

Inside the reader literals, the control may not be exactly like the usual Clojure code because the reader extension decides how to read and interpret that


yes, Vase has docs on action literals


i think i have to study 1-2 docs, I am looking at them n ow