-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demo Site: Custom Server: Improve error handling #2617
Conversation
}) | ||
.listen(port, () => { | ||
// eslint-disable-next-line no-console | ||
console.log(`> Ready on http://localhost:${port}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log Ready message in callback (else it is printed before it is actually ready)
.catch((error) => console.error(error)); | ||
.once("error", (err) => { | ||
console.error(err); | ||
process.exit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handle error by exiting, for example when port is not available
}) | ||
.catch((error) => console.error(error)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this catch
Demo implementation: vivid-planet/comet#2595 and vivid-planet/comet#2617
Adapt the custom server according to the [Next docs](https://nextjs.org/docs/pages/building-your-application/configuring/custom-server).
Adapt to next docs https://nextjs.org/docs/pages/building-your-application/configuring/custom-server
see inline comments for the 3 changes I made (the rest is just formatting by prettier)