Fork me on GitHub
#clojurescript
<
2018-12-10
>
sova-soars-the-sora06:12:48

(in response to the question, "do you prefer rum to re-frame")

Bravi14:12:10

Hi everyone. I have a ClojureScript (reagent) application and I would like to add some server side rendering to it for a better support for SEO and etc. Ideally, I’d like to create an isomorphic site. I was looking at http://blog.testdouble.com/posts/2016-01-21-isomorphic-clojurescript and most likely I’ll proceed with this. but just wanted to ask, perhaps there’s a framework already out there that solves this?

jimmy15:12:05

@bravilogy rum supports server rendering out of the box.

nha15:12:07

@bravilogy fuclro, om next and rum all support SSR, but reagent needs Node.js. This is decribed there https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/reagent-server-rendering There are currently no plans to allow rendering on the JVM: https://github.com/reagent-project/reagent/issues/247

Bravi16:12:34

thank you @nxqd and @nha 🙂 now things make sense 😄 damn. I’m so used to re-frame

jaide17:12:31

@bravilogy If your reagent views just return hiccup lists then could you share the reagent view functions between your clojurescript and clojure then render the hiccup into html in your route handlers?

shaun-mahood18:12:07

@bravilogy If you are looking for a reagent specific way to get SSR, http://www.yogthos.net/posts/2015-11-24-Serverside-Reagent.html might help

Lucas Barbosa21:12:45

Is there any good guide for learning clojurescript? I have an opportunity to write an internal web application for my company and I'd like to do it in clojurescript for the pure purpose of learning

shaun-mahood22:12:20

There are lots of good resources on https://clojurescript.org , particularly in https://clojurescript.org/community/books

👍 4
Lucas Barbosa22:12:04

Awesome! Thanks :star-struck:

idiomancy22:12:58

grrrr having trouble with node interop:

(.DynamoDB. (nodejs/require "aws-sdk"))
> service.js:25 throw AWS.util.error(new Error(), ^ >Error: Service must be constructed with `new' operator
(new (.DynamoDB (nodejs/require "aws-sdk")))
> (new cljs.nodejs.require.call(null,"aws-sdk").DynamoDB()()) ^ > TypeError: cljs.nodejs.require.call is not a constructor

idiomancy22:12:32

(╯°□°)╯︵ ┻━┻

madstap22:12:46

@idiomancy Try (DynamoDB. (nodejs/require "aws-sdk")) (without the leading .?

idiomancy22:12:24

TypeError: myns.core.DynamoDb is not a constructor

idiomancy22:12:42

(╯°□°)╯︵ ┻━┻

idiomancy22:12:06

ooh! (new (aget (nodejs/require "aws-sdk") "DynamoDB"))

idiomancy22:12:14

=> #object[Object [object Object]]

idiomancy22:12:22

gettin somewhere!

madstap22:12:02

aget is technically not correct to use on an object though

madstap22:12:38

So you should either use (new (.-DynamoDB (nodejs/req...))

idiomancy22:12:09

what if the service name came from a variable, etc

madstap22:12:30

Or (new (goog.object/get (nodejs/req...) "DynamoDB"))

idiomancy22:12:42

huh interesting

madstap22:12:51

Lemme google the article

madstap22:12:00

Basically, aget for arrays, goog.object/get for objects

idiomancy22:12:05

(new (goog.object/get (nodejs/require "aws-sdk") "DynamoDB")) > throw AWS.util.error(new Error(), ^ > Error: Service must be constructed with `new' operator

madstap22:12:47

That's strange, from what I understand that should work...

madstap23:12:59

What about the .-DynamoDB (nodejs/...) version ?