Fork me on GitHub

Where do beginners clojurescript questions belong? Because the following question will show I'm a total beginner in both clojurescript and web dev in general I'm afraid 😄. I trained a machine learning model in clojure and now I would like to use it in a small interactive webpage. I dived into using clojurescript for this, without really thinking much of exactly how I would communicate between my webapp and the model. The input for the model is a simple clojure vector, the output a single number. What would be the best way to this input-output communication going between clojurescript and clojure?


It's either here or in #beginners


As to your actual question, it seems like a plain AJAX request is more than enough.


Thanks for the quick answer! 🙂 I'll look into AJAX requests, a quick search suggests to use cljs-http, is that still the standard/easiest way?


Yeah, the library is still widely used, you should be fine with it.


Great thanks! A last, very beginner question, is it ok to use the same base url (with different routing ofc) for both my clojurescript app and for my clojure "api"?

Robin Jakobsson13:02:34

Yes, that should work.


I’m trying to make a router work with an re-frame application, but I’m not sure yet how do I make something like react-router with clojurescript, anyone that can help with? I tried to use secretary and now I’ve changed to re-frame-routing that uses bidi and pushy under the hood, but I still couldn’t make it work


I'm using kee-frame with bidi, it works perfectly. What do you mean by "couldn't make it work", what were the exact issues?


I have used secretary without problems. What does react-router do differently?


The problem is that I couldn’t sync secretary’s dispatch! with browser’s url, I was able to route the application internally but the route doesn’t reflect on the browser URL, and if I try to change the URL manually (like a href’s link) the page reloads


I've recently had the same question for secretary. Take a look at accountant which works together with secretary to take care of the browser history, it will update the browser, too.