This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-16
Channels
- # announcements (1)
- # aws (6)
- # babashka (17)
- # beginners (30)
- # calva (12)
- # cider (25)
- # circleci (2)
- # clojure (42)
- # clojure-australia (8)
- # clojure-czech (1)
- # clojure-europe (30)
- # clojure-france (52)
- # clojure-italy (2)
- # clojure-nl (16)
- # clojure-serbia (3)
- # clojure-uk (10)
- # clojurescript (40)
- # core-async (5)
- # cursive (24)
- # datalog (7)
- # datomic (8)
- # emacs (4)
- # events (1)
- # figwheel-main (3)
- # fulcro (2)
- # helix (5)
- # heroku (1)
- # kaocha (6)
- # leiningen (3)
- # malli (11)
- # music (5)
- # off-topic (20)
- # practicalli (1)
- # re-frame (4)
- # react (8)
- # reitit (14)
- # rewrite-clj (5)
- # rum (2)
- # schema (2)
- # shadow-cljs (23)
- # vrac (28)
- # wasm (4)
- # xtdb (12)
- # yada (5)
I need to add a back end to what I’ve created with create-shadow-cljs-app which has been awesome… I’ve used Luminus and so on in the past but am not attached to anything… I develop locally and will be hosting it all on something like Digital Ocean… I’ve gotten wary of the totally integrated front-and-back end solutions as any hang makes me have to reload it all. Is it possible to develop the front and back ends separately and still connect to the repl’s from Emacs? I always run into CORS confusion doing that while developing locally… any thoughts or quick suggestions of approaches to look at?
My preferred approach is running a shadow-cljs dev server with a custom ring handler for my API. Single nrepl connection for both clj/cljs repl, single http server so no CORS and it starts up fast enough 👌
I think you can also setup shadow-cljs to proxy API requests to another server if you are really sold on two separate processes
https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http lists a variety of ways you could configure the dev server
Cool… this is helpful. I’m not sold on any approach at all… I just am pretty confused probably about what’s actually going on.
How do you create your shadow-cljs apps at the start?
but can easily move on to whatever.
My probably incorrect thinking is that I have to add a ton of stuff in to shadow-cljs to get a back end working along with it… when the truth may not be that at all.
Reading the link you had in your message earlier now.
Holy smokes… it looks like I can do it all in shadow-cljs with a ring handler. I think you just said that, haha. 🙂
Another benefit with having both in the same process is you can use the shadow-cljs inspector for both clj/cljs
You can access it via http://localhost:9630/ just in case you didn't know 👌
shadow-cljs inspector… get outta town… one sec…
well I’ll be damned.
I’ve seen that in a framework… I just didn’t realized I had it with any shadow-cljs project.
reading about what you mean by tap> here https://clojureverse.org/t/introducing-shadow-cljs-inspect/5012
any thoughts on starting an app with lein new luminus someapp +reagent +shadow-cljs
vs create-cljs-app
?
it sounds like you might do neither.
They recently added https://github.com/reagent-project/reagent/blob/master/doc/ReactFeatures.md#function-components in the 1.0 release which makes it super easy to leverage react hooks
(def functional-compiler (reagent.core/create-compiler {:function-components true}))
(reagent.dom/render [my-app] div functional-compiler)
It's opt in though to preserve backwards compatibilitywhat does that enable (I forgot the advantages of React hooks).
I think it mostly just makes it easier to interop with various libraries in the react ecosystem
I’m also excited about a couple frameworks but they still don’t play nicely with my Emacs live dev setup so I’m still going this route for now.
I often use cider-connect-to-clj&cljs in Emacs when a framework type thing launches both… but I guess if I did them separately I’d do them in turn.
I’m not against a combined front-end/back-end situation, btw… I just recall loooong restarts when I bork my recur experimentation. 🙂
It doesn’t seem to work… the page gets hung in an endless reload… but I’m probably doing something wrong.
Maybe some approaches reload quickly or work that out another way.
I wonder is there any documentation on the type hint ^js here: (.registerComponent ^js (.-AppRegistry rn) “app” #(reagent/reactify-component views/root))
https://shadow-cljs.github.io/docs/UsersGuide.html#infer-externs this section Type-hint to help externs generation explains it