init project

This commit is contained in:
root
2026-04-13 13:59:26 -04:00
parent f190e6b91a
commit e26e15f98f
54 changed files with 3280 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
{
"name": "@tlm/sample-bot",
"private": true,
"type": "module",
"scripts": {
"start": "node server.mjs"
}
}
+24
View File
@@ -0,0 +1,24 @@
import http from "node:http";
const port = Number(process.env.PORT ?? "9999");
const server = http.createServer((req, res) => {
if (req.method === "POST") {
let body = "";
req.on("data", (c) => {
body += c;
});
req.on("end", () => {
console.log(`[${new Date().toISOString()}] webhook ${body}`);
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("ok");
});
return;
}
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("POST JSON payloads from TLM bot webhooks here.");
});
server.listen(port, () => {
console.log(`Sample bot webhook receiver listening on http://127.0.0.1:${port}`);
});