TutorialPost
Shipping it with a systemd unit
The last chapter puts the server on a real machine: a user of its own, a unit file, logs in journald and a restart when it falls over.
Servers, databases and what happens between a request and its response.
TutorialPost
The last chapter puts the server on a real machine: a user of its own, a unit file, logs in journald and a restart when it falls over.
TutorialPost
Node ships a test runner. Twelve tests cover the router and the middleware, and none of them opens a port.
Letter
Changelog
Links can expire after a date or a number of clicks, and the API answers 410 for them. The link list now comes wrapped in an object.
A link can carry expires_at or max_clicks now, and stummel answers 410 Gone once either is reached. Half the links people asked me to delete were for events that were over.GET /api/links returns { "links": [...], "next": "..." } instead of a bare array, so the list can page. Update your client before you upgrade.Added
expires_at and max_clicks on a link, in the API and the form.410 Gone with a short page instead of 404.GET /api/links with next.Changed
GET /api/links wraps the list in links.Fixed
-const links: Link[] = await res.json();
+const { links, next } = await res.json() as { links: Link[]; next?: string };
Post
node --watch restarts the process when a file it loaded changes. It replaced a dependency and a config file in stummel.
1 min
Incident
The certificate expired at 06:00. Renewal had failed for three weeks, and the warning mails went to a folder I never open.
Resolved
Major
Every short link answered with a certificate error for 47 minutes on Wednesday morning. The certificate expired at 06:00 CEST. Its renewal had failed every night for three weeks, and each failure sent a mail that a filter of mine moved into a folder I never open. I closed port 80 when I moved the server, because stummel only serves HTTPS. The HTTP-01 challenge needs port 80. Renewal failed quietly for 21 nights.Timeline
What went wrong
What changed
TutorialPost
A middleware is a function that takes a handler and returns a handler. Logging and a token check, nested without a framework.
Post
We parsed query strings by hand for an afternoon, then deleted it and used URLSearchParams. Notes from both sides of the keyboard.
1 min
Changelog
A short link with ?ref= passes it on to the target now. One fix, no breaking change.
A short link called with a query string passes it on to the target, so /k3x9?ref=mail lands on …/path?ref=mail. Three people asked for this in a week.Fixed
&.
TutorialPost
Each path gets its own handler, and /posts/:slug hands the slug over as a parameter. None of the 20 lines is a regular expression.
Letter
TutorialPost
Method, path, headers and body, turned into a standard Request. The server still answers everything with the same text.