This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-10
Channels
- # adventofcode (9)
- # bangalore-clj (1)
- # beginners (130)
- # boot (6)
- # cljs-dev (8)
- # cljsjs (12)
- # cljsrn (3)
- # clojure (33)
- # clojure-brasil (3)
- # clojure-korea (4)
- # clojure-russia (150)
- # clojure-sanfrancisco (4)
- # clojure-spec (159)
- # clojure-uk (3)
- # clojurescript (100)
- # code-reviews (9)
- # core-async (1)
- # datascript (3)
- # dirac (58)
- # hoplon (8)
- # jobs-discuss (10)
- # luminus (18)
- # om (2)
- # onyx (14)
- # protorepl (19)
- # re-frame (34)
- # reagent (28)
Hi, are there any working examples that using reagent + server routing in one project? I am currently working for a project that needs API relay in the reagent project. If I do not do API relay, there is a CORS problem when using APIs from another domain. What is the recommended way to do this? Are there any working examples? Or should I create a Ring server in the same project to do API relay? Thanks.
@cmal: what do you mean by API relay? There are solutions for having ring and reagent in the same project and for separate projects and allowing CORS as well. Do you have a preference?
@shaun-mahood I have to request APIs from server side other than browser because of CORS. So I try to solve this problem by trying to add a routing server in my frontend project. The constraint here is that I can only maintain one project to do the job. Thanks.
@cmal: Ok, 2 options you could check out are Luminus ( http://www.luminusweb.net ) and chestnut ( https://github.com/plexus/chestnut ) - both have front end and back end in a singlw project. I think you can also do it with a new reagent template ( https://github.com/reagent-project/reagent-template/ ).
@shaun-mahood Thanks. I will dive into chestnut for some ideas. I currently use re-frame
in the frontend project and try to connect to a mongo db backend server and/or its APIs.
Hi, folks. A beginner here. I was trying to whip together a simple proof of concept of server rendered reagent. I had started with an actual clojure app, using http-kit, with the intention of using reagent's server utils (`render-to-string`). I quickly realized that reagent is clojurescript (duh) and cannot be used via clojure directly.
Since these server util functions are clojurescript, does this mean there's an approach to running clojurescript on the server? Or can reagent work with clojure? I saw the cookbook, using nashorn, but if that's what it takes I think I may just prefer to stick with my current node version of this project.
My clojure demo is like a basic 10 liner. Is there something comparable in clojurescript?
@ryancole You can use server-side render-to-string
with clojurescript on node. See: https://github.com/TerjeNorderhaug/cljsnode
@terje OK, that's kind of where I was heading next. So, now I'd no longer be running a JVM Clojure, on the server, I'd be running Node ClojureScript, correct? Which means my dependencies would no longer be Clojure (JVM) they'd be from the NPM world (JS)?
Right. If you still need Clojure/JVM functionality consider an architecture with a cljs/node front-end server and a clojure/jvm back-end server.
I'm not against CLJS on server. The current implement of this application I'm contemplating converting to Clojure is in plain node.
I'd be familiar with the modules, etc. I can just already imagine issues where interop is kind of wonky, or there lacks CLJS wrappers, etc.
I havent played with this yet, but seems possibly relevant: http://yogthos.net/posts/2016-11-30-Macchiato.html
A benefit of using cljs on node is better ability to share code between browser app and server.
Yea, I totally agree there. I'm just wondering if there's an annoyance of having to locate wrappers for various javascript modules, etc.
See CLJSJS https://cljsjs.github.io/
@ryancole I'm finding interop is usually not too hard to wrap up, and I'm hoping to get some official wrappers for stuff like db drivers