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.status(event => {
if (event === 'abort' || event === 'fail') {
logger.error('HMR error status: ' + event);
// Signal webpack.run.js to do full-reload of the back-end
service.gracefulShutdown(event);
}
// adddintionally when event is idle due to external modules
if (event === 'idle') {
service.gracefulShutdown(event);
}
});
module.hot.accept();
process.on('uncaughtException', ex => {
logger.error(ex);
process.exit(1);
});
module.hot.dispose(() => {
try {
if (server) {
server.close();
}
} catch (error) {
logger.error(error.stack);
}
});
module.hot.accept(['./website'], () => {
process.on('unhandledRejection', reason => {
logger.error(reason);
});
process.on('unhandledRejection', reason => {
logger.error(reason);
});
const service = new Service();
export const websiteMiddleware = async (req, res, next) => {
try {
if (req.url.indexOf('.') < 0 && __SSR__) {
return renderServerSide(req, res);
} else {
return next();
}
} catch (e) {
logger.error('RENDERING ERROR:', e);
return next(e);
}
};
const page = (
);
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.dispose(data => {
try {
(data as any).subscriptionServer = subscriptionServer;
} catch (error) {
logger.error(error.stack);
}
});
}
module.hot.accept(['./api/subscriptions'], () => {
try {
addGraphQLSubscriptions(server);
} catch (error) {
logger.error(error.stack);
}
});