Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
server.use((req, res) => {
const app = createElement(App, {
path: req.url
});
const {html, css, injectedKeys} = StyletronServerLegacy.renderStatic(() => {
return renderToString(app);
});
const hydrationSrc = generateHydrationScriptSrc(injectedKeys);
res.end(getMarkup(html, css, hydrationSrc));
});
server.use((req, res) => {
const styletron = new StyletronServer();
const app = createElement(StyletronProvider, {styletron}, createElement(App, {
path: req.url
}));
const {html, css, injectedKeys} = StyletronServerLegacy.renderStatic(() => {
return renderToString(app);
});
const modernCss = styletron.getStylesheetsHtml();
const hydrationSrc = generateHydrationScriptSrc(injectedKeys);
res.end(getMarkup(html, modernCss, css, hydrationSrc));
});