Fork me on GitHub
#clojurescript
<
2020-02-21
>
Frederik12:02:39

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?

p-himik12:02:38

It's either here or in #beginners

p-himik12:02:04

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

Frederik12:02:39

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?

p-himik12:02:16

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

Frederik12:02:32

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.

matheusashton20:02:17

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

p-himik20:02:51

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?

Crispin02:02:06

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

matheusashton16:02:17

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

schaueho16:02:16

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.