Merge pull request #371 from formulahendry/junhan/http-doc
docs: add error handling when it fails to start HTTP server
This commit is contained in:
commit
5e20ee1fc5
1 changed files with 11 additions and 2 deletions
13
README.md
13
README.md
|
|
@ -590,8 +590,17 @@ app.delete('/mcp', async (req: Request, res: Response) => {
|
|||
|
||||
// Start the server
|
||||
const PORT = 3000;
|
||||
app.listen(PORT, () => {
|
||||
console.log(`MCP Stateless Streamable HTTP Server listening on port ${PORT}`);
|
||||
setupServer().then(() => {
|
||||
app.listen(PORT, (error) => {
|
||||
if (error) {
|
||||
console.error('Failed to start server:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`MCP Stateless Streamable HTTP Server listening on port ${PORT}`);
|
||||
});
|
||||
}).catch(error => {
|
||||
console.error('Failed to set up the server:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue