* In src/everything/sse.ts
- add SIGINT handler that does cleanup, server.close, and process.exit
This commit is contained in:
parent
3894d236c0
commit
26aa0f8091
1 changed files with 8 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ app.get("/sse", async (req, res) => {
|
|||
await cleanup();
|
||||
await server.close();
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
app.post("/message", async (req, res) => {
|
||||
|
|
@ -27,7 +28,14 @@ app.post("/message", async (req, res) => {
|
|||
await transport.handlePostMessage(req, res);
|
||||
});
|
||||
|
||||
process.on("SIGINT", async () => {
|
||||
await cleanup();
|
||||
await server.close();
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
const PORT = process.env.PORT || 3001;
|
||||
app.listen(PORT, () => {
|
||||
console.error(`Server is running on port ${PORT}`);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue