Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.hot.accept(['./middleware/graphql'], () => {
logger.debug('loading ./middleware/graphql');
});
// module.hot.accept(['./api/subscriptions'], () => {
onConnect: async (connectionParams, webSocket) => {
logger.debug(`Subscription client connected using built-in SubscriptionServer.`);
const pureContext = await modules.createContext(connectionParams, webSocket);
const contextServices = await serviceContext(connectionParams, webSocket);
return {
...contextServices,
...pureContext,
preferences: defaultPreferences,
update: updateContainers,
};
},
// onDisconnect: () => {},
module.hot.accept(['./website'], () => {
logger.debug('...reloading middleware');
});
);
res.send(`\n${ReactDOMServer.renderToStaticMarkup(page)}`);
res.end();
}
} catch (err) {
logger.error('SERVER SIDE RENDER failed due to (%j) ', err.message);
logger.debug(err);
}
}
export const websiteMiddleware = async (req, res, next) => {
module.hot.accept(['./middleware/graphql'], () => {
logger.debug('loading ./middleware/graphql');
});
module.hot.accept(['./api/subscriptions'], () => {
const addGraphQLSubscriptions = httpServer => {
if (module.hot && module.hot.data) {
const prevServer = (module.hot.data as any).subscriptionServer;
if (prevServer && prevServer.wsServer) {
logger.debug('Reloading the subscription server.');
prevServer.wsServer.close(() => {
addSubscriptions(httpServer);
});
}
} else {
addSubscriptions(httpServer);
}
};