Fork me on GitHub
Pablo Fernandez19:08:46

Is this the best way to pre-render reagent on the server: ?


Yeah, I think so. (I believe Matt Ho also has an updated version too, but hasnt pushed it to github yet.)

Pablo Fernandez19:08:01

Why not using PhatomJS directly, like for testing?


I believe express is more flexible and natural to use, you can handle routes etc.

Pablo Fernandez19:08:27

express? What is express?


Have you pulled down the repo and ran the "quick start"

Pablo Fernandez19:08:52

henryzhu: nope. I don’t understand why nodejs is used in these cases, or how actually.


Essentially we need a JavaScript runtime on our server (in this case we use nodeJS) to run the JS that Reagent/CLJS generates. After the JS it’s fully rendered to HTML in Node, we serve the HTML to our browser via Express routing.


And basically you get an app like this: fully SEO crawlable web app with a fast initial page load.