Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
try {
// eslint-disable-next-line no-underscore-dangle
hydrate(window.__emotion);
const client = new ApolloClient({
// eslint-disable-next-line no-underscore-dangle
initialState: window.__APOLLO_STATE__,
networkInterface: networkInterface('/graphql'),
fragmentMatcher,
});
const BrowserRouter = await createInitialBrowserRouter({
historyMiddlewares,
historyOptions: { useBeforeUnload: true },
routeConfig,
render,
});
ReactDOM.hydrate(
,
url: req.url,
historyMiddlewares,
routeConfig,
render,
});
if (redirect) {
res.redirect(302, redirect.url);
return;
}
const port = parseInt(KYT.SERVER_PORT, 10);
const uri = `http://localhost:${port}/graphql`;
const client = new ApolloClient({
ssrMode: true,
networkInterface: networkInterface(uri),
fragmentMatcher,
});
const app = (
{element}
);
getDataFromTree(app).then(() => {
const { html, ids, css } = extractCritical(renderToString(app));
const initialState = {
apollo: client.getInitialState(),
};
res.status(200);