There is documentation on how to render a simple example using Done-SSR, but I don’t understand how that translates to a DoneJS application. I want to be able to specify that all the routes should be server side rendered except for one (and it’s children).
Can someone point me to an example?
I believe you can wrap that route in an if statement
If(!window.doneSsr){
route(…)
}
doneSsr might be the wrong attribute name, but if it doesn’t work you can console.log the keys on window to find it, refresh the page then check the terminal window
There is a window.doneSsr, that’s right, you can also check if you are running in Node:
var isNode = typeof process === "object" && {}.toString.call(process) === "[object process]";
I’m confused though, at this point isn’t the application already loaded into the client? How do I prevent the app from client side loading?
The same code runs on the client and server, so if you write some code like:
If(!window.doneSsr){
route(...)
}
In Node this route will not be defined and therefore won’t be available to go to. In the client it will be available (if say you are going from page a to b).
My question is in the reverse. This would be how to exclude a section from SSR. But I want to know how to have pages Server Side rendered.
Generate an app with DoneJS and run donejs develop
and all pages are automatically SSR’d.