morgue / specimen / ghost-todo-api
ghost-todo-api
A JSON todo API that died when Express 4 dropped Connect and Node 12 dropped util.puts.
era Express 3 · Node 0.10† 2014-10-31files 5 · lines 159
pulse · before
16%
pulse · after
—
☠
cause of death
Bundled Connect middleware removed in Express 4 (app.js:11)
7
dependencies audited
3
dead or deprecated
18
breaking call sites
5
config fossils
Dependency graveyard
| package | declared | latest | status | diagnosis | treatment |
|---|---|---|---|---|---|
| node-uuid | 1.4.1 | 1.4.8 | dead | Renamed to `uuid` in 2016; Node 14.17+ has crypto.randomUUID(). | remove |
| express | 3.4.8 | 5.3.0 | outdated | Express 3 → 5: bundled Connect middleware removed, app.configure/app.router gone, res.send(status, body) and req.param() removed. | → ^5.3.0 |
| moment | 2.5.1 | 2.31.0 | deprecated | Moment is in maintenance mode and recommends lighter, immutable alternatives. | → dayjs@^1.11.23 |
| request | 2.34.0 | 2.88.2 | deprecated | Deprecated since Feb 2020. Node 18+ ships a native fetch(). | remove |
| jshint dev | 2.4.4 | 2.13.6 | fossil | Superseded by ESLint flat config. | → eslint@^10.15.0 |
| mocha dev | 1.17.1 | 12.0.3 | fossil | Legacy test runner; node:test is built into Node 20+. | remove |
| should dev | 3.1.2 | 13.2.3 | fossil | Prototype-extending assertion library; node:assert is built in. | remove |
Config fossils
- .travis.ymlTravis CI configtravis-ci.org shut down in 2021; targets Node 0.10, 0.8. CI has been silently dead.→ Replace with a GitHub Actions workflow on Node 20/22.
- .jshintrcJSHint configJSHint does not understand modern syntax and is superseded by ESLint.→ Translate options and globals into an ESLint 9 flat config.
- package.jsonengines.node "0.10.x"Pinned to a Node.js release that reached end-of-life years ago.→ Set engines.node to ">=20".
- (none)No lockfileInstalls are not reproducible; the dependency tree drifts on every install.→ Commit the package-lock.json generated by the first `npm install`.
- (none)No licenseNobody can legally reuse the resurrected code.→ Add an OSI license (MIT/Apache-2.0).
Breaking changes in the code
- app.js:10app.configure() removed in Express 4app.configure(function () {
- app.js:11Bundled Connect middleware removed in Express 4app.use(express.logger('dev'));
- app.js:12Bundled Connect middleware removed in Express 4app.use(express.bodyParser());
- app.js:13Bundled Connect middleware removed in Express 4app.use(express.methodOverride());
- app.js:14app.use(app.router) throws in Express 4+app.use(app.router);
- server.js:7util.puts/print/debug/error (removed in Node 12)util.puts('Ghost Todo API haunting port ' + port);
- app.js:20new Buffer() → Buffer.from()/Buffer.alloc()var decoded = new Buffer(token, 'base64').toString();
- app.js:22res.send(status, body) removed in Express 5return res.send(401, { error: 'the spirits do not know you' });
- app.js:36req.param() removed in Express 5var todo = store.get(req.param('id'));
- app.js:38res.send(status, body) removed in Express 5return res.send(404, { error: 'no such haunting' });
- app.js:44req.param() removed in Express 5var title = req.param('title');
- app.js:46res.send(status, body) removed in Express 5return res.send(400, { error: 'title required' });
- app.js:54res.send(status, body) removed in Express 5res.json(201, format.todo(todo));
- app.js:57app.del() → app.delete()app.del('/todos/:id', auth, function (req, res) {
- app.js:58req.param() removed in Express 5store.remove(req.param('id'));
- app.js:59res.send(status, body) removed in Express 5res.send(204);
- app.js:65res.send(status, body) removed in Express 5return res.send(502, { error: 'the oracle is silent' });
- lib/quotes.js:1request / request-promise → native fetch compat shimvar request = require('request');
- app.js:2node-uuid → crypto.randomUUID()var uuid = require('node-uuid');
- app.js:3moment → dayjs (+ plugins)var moment = require('moment');
- app.js:49node-uuid → crypto.randomUUID()id: uuid.v4(),
- lib/format.js:1moment → dayjs (+ plugins)var moment = require('moment');
Migration plan
01Exhume config fossils
- Travis CI config: Replace with a GitHub Actions workflow on Node 20/22.
- JSHint config: Translate options and globals into an ESLint 9 flat config.
- engines.node "0.10.x": Set engines.node to ">=20".
02Transplant dependencies
- express@3.4.8 → express@^5.3.0 — Breaking changes patched by 6 codemods.
- moment@2.5.1 → dayjs@^1.11.23 — Swapped by moment-to-dayjs.
- node-uuid@1.4.1 → removed — Call sites migrated by node-uuid-to-crypto.
- request@2.34.0 → removed — Call sites migrated by request-to-fetch-shim.
- jshint@2.4.4 → eslint@^10.15.0 — Use eslint instead.
- mocha@1.17.1 → removed — Replaced by the generated node:test suite.
- should@3.1.2 → removed — Replaced by the generated node:test suite.
- + morgan@^1.12.1 — Replaces express.logger()
- + method-override@^3.0.0 — Unbundled from Express 3
- + @eslint/js@^10.0.1 — ESLint recommended rules
03Suture breaking changes (AST codemods)
- node-uuid → crypto.randomUUID() — 2 patched
- moment → dayjs (+ plugins) — 2 patched
- Bundled Connect middleware removed in Express 4 — 3 patched
- app.use(app.router) throws in Express 4+ — 1 patched
- new Buffer() → Buffer.from()/Buffer.alloc() — 1 patched
- res.send(status, body) removed in Express 5 — 6 patched
- req.param() removed in Express 5 — 3 patched
- app.del() → app.delete() — 1 patched
- app.configure() removed in Express 4 — 1 patched
- request / request-promise → native fetch compat shim — 1 patched
- util.puts/print/debug/error (removed in Node 12) — 1 patched
04Galvanize regression tests
- test/necro/examples.test.cjs: 6 jsdoc-example cases
- test/necro/modules.test.cjs: 4 module-load cases
- test/necro/routes.test.cjs: 6 route-smoke cases
- test/necro/boot.test.cjs: 1 entrypoint-boot case
05Verify pulse
- npm install on Node 20/22
- npm test → node --test test/necro/examples.test.cjs test/necro/modules.test.cjs test/necro/routes.test.cjs test/necro/boot.test.cjs
- npm run lint