Back to article list

This Week I Renamed a bunch of API Endpoints

2 min read

What I Did This Week

Spent the week normalizing orchestrator-api endpoints. Sounds fancy, but really just renamed a bunch of routes.

The changes:

  1. /health/healthz — because it looks more "Kubernetes-native". That's it. That's the whole reason.
  2. POST /api/harness/entropy/tasksGET — called it "RESTful", but really just didn't want to deal with request body parsing
  3. Added /api/v1 prefix — to pretend we're a serious project
  4. Created route-table.ts and dumped all routes in there — to feel like I'm in control
  5. Auto-generated OpenAPI skeleton — generated ≠ finished

Code Changes

Health check:

// Old
router.get('/health', healthHandler);
// New
router.get('/healthz', healthHandler);

Kept the old route as an alias, added a Deprecation header.

Entropy Tasks:

// Before: POST to create
// Now: GET to query
// The logic underneath? Still the same mess

After centralizing routes, it looks like this:

export const routeTable = [
  { method: 'GET', path: '/healthz', ... },
  // dozens of routes in one file
];

Good for auto-generating docs. Bad for finding where the actual handler lives.


The Uncomfortable Truth

What was I actually doing this week?

Naming addiction: Changing /health to /healthz adds zero value. One extra keystroke, nothing else. Just satisfying my own naming fetish.

Fake REST: Changing POST to GET wasn't about being "RESTful". It was because handling request bodies is annoying. URL got longer, problem didn't go away.

v1 illusion: Adding /api/v1 makes me feel like a real project. But the business logic doesn't even have a proper state machine. v1 doesn't mean stable—it means a redirect time bomb waiting to happen.

Documentation self-deception: Auto-generated OpenAPI skeleton is a Word doc titled "Novel". Generating ≠ completing, automating ≠ maintaining.

Control theater: Putting all routes in route-table.ts because I'm terrified of scattered code. Using neat file layout to hide modular failure.


Conclusion

This week's refactoring is "edge patching" — too scared to touch core logic, so I play with routes, aliases, and naming. Real system evolution isn't in route tables. It's in state machines and business logic.

The only real change this week: I successfully created a bunch of work for myself while the system itself didn't improve at all.


TL;DR: Spent the week moving furniture. Didn't fix the house.

Found this helpful? Buy me a coffee

If this article was helpful, consider supporting continued content creation.

WeChat
WeChat
Alipay
Alipay

评论