Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.listen(port, host)
.on('listening', () => {
if (!this.config.quiet) {
console.log(`Listening on http://${host || 'localhost'}:${port}/\n`);
}
})
.on('error', e => {
if (e.code === 'EADDRINUSE') {
console.error(`Port ${port} already in use.`);
process.exit(1);
} else {
console.error(e);
}
});
gracefulShutdown(this.server);
return this.server;
}
}
const server = mountedServer.listen(port, host, () => {
readline.clearLine(process.stdout);
readline.cursorTo(0, process.stdout);
process.stdout.write(`\x1b[0G${chalk.green('\u2713')} Server listening on: ${
chalk.bold.underline(`http://${host}:${port}${config.basePath}`)
}\n`);
if (module.hot) {
console.log(`${chalk.green('\u2713')} ${chalk.bold('Hot module reload')} activated`);
process.stdout.write(`\x1b[0G${
chalk.blue('\uD83D\uDD50 Building client bundle [in memory]...')
}`);
}
});
httpGracefulShutdown(server, {
signals: 'SIGINT SIGTERM SIGQUIT',
timeout: 15000,
development: process.env.NODE_ENV !== 'production',
callback: () => {},
});