nodejs.md

 1# Node.js
 2
 3Uses the built-in `https` module — no third-party dependencies required. Run each example as a standalone script.
 4
 5## Examples
 6
 7### Normal success
 8
 9```javascript
10const https = require("https");
11const req = https.request(
12  `https://ntfy.sh/${process.env.NTFY_TOPIC_LLM}`,
13  {
14    method: "POST",
15    headers: {
16      Authorization: `Bearer ${process.env.NTFY_ACCESS_TOKEN}`,
17      Title: "Refactored authentication middleware in rumilo",
18      Tags: "hammer_and_wrench",
19    },
20  },
21  (res) => res.resume()
22);
23req.end(
24  "Finished refactoring the auth middleware in rumilo. Session validation is cleaner now and all tests pass."
25);
26```
27
28### Success with a relevant click URL
29
30```javascript
31const https = require("https");
32const req = https.request(
33  `https://ntfy.sh/${process.env.NTFY_TOPIC_LLM}`,
34  {
35    method: "POST",
36    headers: {
37      Authorization: `Bearer ${process.env.NTFY_ACCESS_TOKEN}`,
38      Title: "Updated AUR package for kagi-ken",
39      Tags: "package",
40      Click: "https://aur.archlinux.org/packages/kagi-ken",
41    },
42  },
43  (res) => res.resume()
44);
45req.end(
46  "Bumped the kagi-ken AUR package to v0.4.2 and updated the checksums."
47);
48```
49
50### Something went wrong
51
52```javascript
53const https = require("https");
54const req = https.request(
55  `https://ntfy.sh/${process.env.NTFY_TOPIC_LLM}`,
56  {
57    method: "POST",
58    headers: {
59      Authorization: `Bearer ${process.env.NTFY_ACCESS_TOKEN}`,
60      Title: "Build failed in pi-mono — disk full",
61      Tags: "rotating_light",
62      Priority: "4",
63    },
64  },
65  (res) => res.resume()
66);
67req.end(
68  "Ran into a full disk on the build server while compiling pi-mono. /var/log looks like it needs rotation. The build is blocked until there's space."
69);
70```
71
72### Urgent failure
73
74```javascript
75const https = require("https");
76const req = https.request(
77  `https://ntfy.sh/${process.env.NTFY_TOPIC_LLM}`,
78  {
79    method: "POST",
80    headers: {
81      Authorization: `Bearer ${process.env.NTFY_ACCESS_TOKEN}`,
82      Title: "Production database unreachable",
83      Tags: "sos",
84      Priority: "5",
85    },
86  },
87  (res) => res.resume()
88);
89req.end(
90  "The primary Postgres instance stopped responding during a migration. Rolled back what we could, but the app is down."
91);
92```