twilio-opencode

A lightweight express server to handle Twilio voice and messaging webhooks for prompting Opencode.
git clone https://unitehenry.com/git/twilio-opencode.git
Log | Files | Refs | README | LICENSE

commit 8c8be6b720fdbd1ca1e316400df00c7ea2158e1d
parent fe03e306f9b5197a68c7f7341d4f230f3a4f8d24
Author: Henry Unite <henry@getpoint.io>
Date:   Thu, 26 Feb 2026 09:39:19 -0800

feat: graceful interrupt

Diffstat:
Mapp.ts | 20+++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/app.ts b/app.ts @@ -19,4 +19,22 @@ app.get("/health", health); const port: number = parseInt(process.env.PORT || "3000", 10); -app.listen(port, (): void => log("INFO", "Server started", { port })); +const server = app.listen(port, (): void => + log("INFO", "Server started", { port }), +); + +process.on("SIGINT", () => { + log("INFO", "Received SIGINT, shutting down gracefully"); + server.close(() => { + log("INFO", "Server closed"); + process.exit(0); + }); +}); + +process.on("SIGTERM", () => { + log("INFO", "Received SIGTERM, shutting down gracefully"); + server.close(() => { + log("INFO", "Server closed"); + process.exit(0); + }); +});