May 2018
Intermediate to advanced
470 pages
13h 54m
English
Once the markup is generated, we first check if there was a redirect rendered in the component to be sent in the markup. If there was no redirect, then we generate the CSS string from the sheetsRegistry, and in the response send the template back with the markup and CSS injected.
mern-skeleton/server/express.js:
if (context.url) { return res.redirect(303, context.url)}const css = sheetsRegistry.toString()res.status(200).send(Template({ markup: markup, css: css}))
An example of a case where redirect is rendered in the component is when trying to access a PrivateRoute via server-side render. As the server side cannot access the auth token from client-side sessionStorage, the redirect in the PrivateRoute ...
Read now
Unlock full access