Add missing app.listen error handling to server examples
This commit is contained in:
parent
22dc79b2a4
commit
4056c098a1
1 changed files with 40 additions and 8 deletions
|
|
@ -102,7 +102,11 @@ async function runServer(port: number | null) {
|
|||
await transport.handlePostMessage(req, res);
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
app.listen(port, (error) => {
|
||||
if (error) {
|
||||
console.error('Failed to start server:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Server running on http://localhost:${port}/sse`);
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue