This shouldn't be a problem - you can send all Flask responses as JSON and 
it will work fine in CLJS.

>From Flask, have a look 
at 
https://stackoverflow.com/questions/13081532/return-json-response-from-flask-view

In Clojurescript, use for instance https://github.com/r0man/cljs-http to 
read the JSON responses.

So something like this in your cljs:

(defn http-get-dispatch [request]
(go (let [response (<! (http/get (:url request)))]
(rf/dispatch (conj (:dispatch-key request) (:body response))))))

(rf/reg-fx :http-get-dispatch http-get-dispatch)

(rf/reg-event-fx
:your-request
(fn [{:keys [db]} [_ x1 x2]] 
{:http-get-dispatch {:url (str "your-server-url?x1=" x1 "&x2=" x2)
:dispatch-key [:your-client-db-key]}}))

(rf/reg-event-db
:your-client-db-key
(fn [db [_ data]] (assoc db :your-client-db-key data)))


On Saturday, January 9, 2021 at 2:32:51 PM UTC pas...@gmail.com wrote:

> Does somebody has experience serving ClojureScript (Re-Frame) through 
> Python Flask? Or even better integrating a Clojure app within an existing 
> Flask app ? I need to add a new module to an existing Flask app and I’d 
> like at least the frontend to be ClojureScript. What are the possibilities?
>
> Kind regards,
> Pascal
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/39b614b7-e2be-4585-84c3-e9b620699817n%40googlegroups.com.

Reply via email to