handle server errors (#91)
This commit is contained in:
parent
4200a46fc2
commit
3dde360dc9
9 changed files with 50 additions and 10 deletions
|
|
@ -153,7 +153,11 @@ app.post("/mcp", async (req, res) => {
|
|||
await transport.handleRequest(req, res, req.body);
|
||||
});
|
||||
|
||||
app.listen(3001, () => {
|
||||
app.listen(3001, (err) => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("Server listening on http://localhost:3001/mcp");
|
||||
});
|
||||
```
|
||||
|
|
|
|||
|
|
@ -70,11 +70,19 @@ sandboxApp.use((_req, res) => {
|
|||
});
|
||||
|
||||
// ============ Start both servers ============
|
||||
hostApp.listen(HOST_PORT, () => {
|
||||
hostApp.listen(HOST_PORT, err => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Host server: http://localhost:${HOST_PORT}`);
|
||||
});
|
||||
|
||||
sandboxApp.listen(SANDBOX_PORT, () => {
|
||||
sandboxApp.listen(SANDBOX_PORT, err => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Sandbox server: http://localhost:${SANDBOX_PORT}`);
|
||||
console.log("\nPress Ctrl+C to stop\n");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -85,7 +85,11 @@ app.post("/mcp", async (req: Request, res: Response) => {
|
|||
}
|
||||
});
|
||||
|
||||
const httpServer = app.listen(PORT, () => {
|
||||
const httpServer = app.listen(PORT, err => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Server listening on http://localhost:${PORT}/mcp`);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,11 @@ app.post("/mcp", async (req: Request, res: Response) => {
|
|||
}
|
||||
});
|
||||
|
||||
const httpServer = app.listen(PORT, () => {
|
||||
const httpServer = app.listen(PORT, err => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`Server listening on http://localhost:${PORT}/mcp`);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -330,7 +330,11 @@ async function main() {
|
|||
}
|
||||
});
|
||||
|
||||
const httpServer = app.listen(PORT, () => {
|
||||
const httpServer = app.listen(PORT, (err) => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(
|
||||
`Budget Allocator Server listening on http://localhost:${PORT}/mcp`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -240,7 +240,11 @@ async function main() {
|
|||
}
|
||||
});
|
||||
|
||||
const httpServer = app.listen(PORT, () => {
|
||||
const httpServer = app.listen(PORT, (err) => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(
|
||||
`Cohort Heatmap Server listening on http://localhost:${PORT}/mcp`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,11 @@ async function main() {
|
|||
}
|
||||
});
|
||||
|
||||
const httpServer = app.listen(PORT, () => {
|
||||
const httpServer = app.listen(PORT, (err) => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(
|
||||
`Customer Segmentation Server listening on http://localhost:${PORT}/mcp`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -346,7 +346,11 @@ async function main() {
|
|||
}
|
||||
});
|
||||
|
||||
const httpServer = app.listen(PORT, () => {
|
||||
const httpServer = app.listen(PORT, (err) => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(
|
||||
`SaaS Scenario Modeler Server listening on http://localhost:${PORT}/mcp`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -211,7 +211,11 @@ async function main() {
|
|||
}
|
||||
});
|
||||
|
||||
const httpServer = app.listen(PORT, () => {
|
||||
const httpServer = app.listen(PORT, (err) => {
|
||||
if (err) {
|
||||
console.error("Error starting server:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(
|
||||
`System Monitor Server listening on http://localhost:${PORT}/mcp`,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue