Skip to content

See how your app actually fits together. An interactive, plain-English map of your codebase, drawn by Claude or Codex.

Find endpoints in route tables keyed by "METHOD /path" (#54)

Yahhi55d5d525b86d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1ae1f14..e81743b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## Unreleased
+
+- **Endpoints in route tables** (#54): servers without a framework often keep their endpoints in a lookup a dispatcher reads, keyed by method and path, like `{ "GET /api/orders": listOrders }` in JavaScript or a Python dict of handlers behind a cloud function. Floorplan found no endpoints in these apps, so the website's requests weren't linked to the server. Now each key is an endpoint, named after its handler (a function, an inline function that calls one, or a wrapped one like `requireAuth(createOrder)`). Tables of other things keyed the same way, like access levels or notes, are left alone. Health doesn't judge sign-in on these endpoints, because the dispatcher or the handler checks it where Floorplan can't see.
+
## 0.6.2 (2026-11-02)
- **Far fewer false alarms in Health** (thanks to @samuelpullen15-droid, who reported 13 of them from one site with the new **Not a problem** button):
diff --git a/README.md b/README.md
index e77ffd2..1fd6567 100644
--- a/README.md
+++ b/README.md
@@ -239,7 +239,7 @@ flowchart LR
Scripts do the mechanical work: finding repos, parsing code in a dozen languages, matching web requests to endpoints, laying out the map. They're plain Node with no dependencies. Claude or Codex does the part only a reader can: deciding what the parts of your app *are*, and saying so plainly. Details in [How it works](docs/how-it-works.md).
**Languages:** TypeScript, JavaScript, Python, Go, Rust, Java, Kotlin, Scala, plus Vue, Svelte and Astro files, with lighter support for others.<br>
-**Endpoints:** Express, Koa, Hono, Next.js, Firebase Cloud Functions, Flask, FastAPI, Django, Go's net/http, Gin, Echo and chi, Actix, Axum, Spring.<br>
+**Endpoints:** Express, Koa, Hono, Next.js, Firebase Cloud Functions, Flask, FastAPI, Django, Go's net/http, Gin, Echo and chi, Actix, Axum, Spring, and route tables keyed by method and path (`"GET /api/orders": listOrders`) in JavaScript and Python.<br>
**Screens:** Next.js, React Router, Vue, SvelteKit, Remix, Nuxt, Astro, Expo, Angular, TanStack.
## What it adds to your project
diff --git a/skills/floorplan/scripts/lib/extract.mjs b/skills/floorplan/scripts/lib/extract.mjs
index 4b14efc..5ee1e82 100644
--- a/skills/floorplan/scripts/lib/extract.mjs
+++ b/skills/floorplan/scripts/lib/extract.mjs
@@ -20,6 +20,46 @@ const stripHash = (src) => src.replace(/(^|\s)#[^\n]*/g, (m, pre) => pre + blank
const all = (re, s) => [...s.matchAll(re)];
+// ---------- route tables keyed by "METHOD /path" ----------
+
+// Servers without a framework often keep their endpoints in a lookup keyed by method and path, and
+// a dispatcher picks the handler: { "GET /api/orders": listOrders } in JS, or
+// { "POST /v1/claim": claim_draft, "GET /v1/paths/{slug}": lambda e, s: get_path(s, e) } in Python.
+// There's no app.get(...) to find, so these keys are the endpoints. A value counts when it names a
+// function (`listOrders`, `oauth.register`), is a short inline function that calls one, or wraps one
+// (`requireAuth(listOrders)`). Tables of other things keyed the same way (access levels, docs, status
+// codes, ALL_CAPS constants) are left alone, and a file needs two such entries before they count.
+const TABLE_KEY = /^[ \t]*["'`](GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|ANY|ALL)[ \t]+(\/[^"'`\s]*)["'`][ \t]*:[ \t]*([^\n]*)/gm;
+const NOT_A_HANDLER = /^(?:[A-Z][A-Z0-9_]*|true|false|null|undefined|None|True|False|await|new|return|lambda|function|async)$/;
+
+function tableHandler(raw) {
+ const v = raw.trim().replace(/,\s*$/, '').trim();
+ const last = (dotted) => dotted.split('.').pop();
+ const ref = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.exec(v);
+ if (ref) return NOT_A_HANDLER.test(last(v)) ? null : { handler: last(v) };
+ // lambda e, s: get_path(s, e) · (req) => getPath(req) · async function (req) { return getPath(req) }
+ const inline = /^(?:lambda\b[^:]*:|(?:async\s+)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>|(?:async\s+)?function\b[^{]*\{)([\s\S]*)$/.exec(v);
+ if (inline) {
+ const call = [...inline[1].matchAll(/([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\(/g)].map((m) => last(m[1])).find((n) => !NOT_A_HANDLER.test(n));
+ return { handler: call || null };
+ }
+ // requireAuth(listOrders), login_required(views.orders): the wrapped function is the handler
+ const wrap = /^[A-Za-z_$][\w$.]*\(\s*([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*[,)]/.exec(v);
+ if (wrap && !NOT_A_HANDLER.test(last(wrap[1]))) return { handler: last(wrap[1]) };
+ return null; // a string, number, object, list, or a call on a constant: not a route table
+}
+
+function keyedRouteTable(code, at) {
+ const out = [];
+ for (const m of all(TABLE_KEY, code)) {
+ const h = tableHandler(m[3]);
+ if (!h) continue;
+ const method = m[1] === 'ALL' ? 'ANY' : m[1];
+ out.push({ method, path: m[2], var: null, line: at(m.index), framework: 'table', ...(h.handler ? { handler: h.handler } : {}) });
+ }
+ return out.length >= 2 ? out : [];
+}
+
// ---------- HTTP call literals ----------
const HTTP_CONTEXT = /\b(fetch|axios|ky|got|request|requests|httpx|aiohttp|session|client|http|https|api|Api|API|endpoint|Endpoint|url|Url|URL|BASE|base)\b|\.(get|post|put|patch|delete|head)\s*(<[^>]*>)?\s*\(|(?<![.\w$])(get|post|put|patch|delete)\s*\(\s*[rf]?["'`]\//;
@@ -202,6 +242,8 @@ function extractJs(src, filePath) {
for (const method of methods.length ? methods : ['ANY']) routes.push({ method, path: p, var: null, line: 1, framework: 'next' });
}
+ routes.push(...keyedRouteTable(code, at));
+
const triggers = /firebase-functions/.test(code) ? firebaseFunctions(code, at, routes, mounts) : [];
const serverLine = /\b\w+\.(use|route)\(\s*["'`]\/|\b(?:app|server|fastify|hono|routes?|router|[a-z]+Router)\.(?:get|post|put|patch|delete|all|options|head)\(\s*["'`]\//;
@@ -373,6 +415,7 @@ function extractPy(src) {
}
for (const method of methods) routes.push({ method, path: m[3], var: m[1], line: at(m.index) });
}
+ routes.push(...keyedRouteTable(code, at));
// Django urls.py
for (const m of all(/\b(?:re_)?path\(\s*r?["']([^"']*)["']\s*,\s*(?!include)/g, code)) routes.push({ method: 'ANY', path: '/' + m[1].replace(/^\^|\$$/g, ''), var: null, line: at(m.index), framework: 'django' });
@@ -583,6 +626,7 @@ function addDocs(src, lang, r) {
const syms = (r.symbols || []).filter((s) => !fbNames.has(s.name)).sort((a, b) => a.line - b.line);
for (const rt of r.routes || []) {
if (rt.framework === 'next') { rt.handler = rt.method; continue; }
+ if (rt.framework === 'table') { const d = r.symbols?.find((s) => s.name === rt.handler)?.doc; if (d) rt.doc = d; continue; }
if (rt.framework === 'firebase') { const d = r.symbols.find((s) => s.name === rt.handler)?.doc || commentBefore(lines, rt.line - 1); if (d) rt.doc = d; continue; }
const h = syms.find((s) => s.line >= rt.line && s.line - rt.line <= 12);
if (h) { rt.handler = h.name; if (h.doc) rt.doc = h.doc; }
diff --git a/skills/floorplan/scripts/lib/health.mjs b/skills/floorplan/scripts/lib/health.mjs
index b7a94c0..51c78ad 100644
--- a/skills/floorplan/scripts/lib/health.mjs
+++ b/skills/floorplan/scripts/lib/health.mjs
@@ -323,7 +323,8 @@ function pyRoutes(src, f, out) {
}
for (const r of f.routes || []) {
- if (r.framework === 'django') continue;
+ // django: no per-route checks to read; table: sign-in is checked by the dispatcher or inside the handler
+ if (r.framework === 'django' || r.framework === 'table') continue;
const i0 = r.line - 1;
// decorators above the route decorator (wrong place in Flask/FastAPI: the route registers the unwrapped function)
const above = [];
@@ -384,6 +385,7 @@ function jsRoutes(src, f, out) {
for (const u of uses) if (u.v === 'app' || u.v === 'server') out.push({ k: 'global-guard', framework: 'express', name: u.name, line: u.line });
routes.forEach((r, idx) => {
+ if (r.framework === 'table') return; // sign-in is checked by the dispatcher or inside the handler
const rec = { k: 'route', line: r.line, method: r.method };
if (r.framework === 'firebase') {
// a callable checks request.auth (v1: context.auth) or turns on App Check; an onRequest function
diff --git a/tests/fixtures/route-table-keys/api/library/app.py b/tests/fixtures/route-table-keys/api/library/app.py
new file mode 100644
index 0000000..8180e1a
--- /dev/null
+++ b/tests/fixtures/route-table-keys/api/library/app.py
@@ -0,0 +1,34 @@
+"""Library server: one function behind a cloud HTTP gateway, routed by a lookup table."""
+import json
+
+import auth
+import books
+
+
+def list_books(event):
+ """The whole catalogue, newest first."""
+ return 200, books.newest()
+
+
+def get_book(event, book_id):
+ """One book with its loan history."""
+ return 200, books.one(book_id)
+
+
+def health(event):
+ return 200, {"ok": True}
+
+
+ROUTES = {
+ "GET /api/books": list_books,
+ "GET /api/books/{book_id}": get_book,
+ "POST /api/books/{book_id}/loans": books.lend,
+ "POST /api/login": auth.login,
+ "GET /api/status": lambda e: health(e),
+}
+
+
+def handler(event, context):
+ route = f'{event["method"]} {event["path"]}'
+ fn = ROUTES.get(route)
+ return fn(event) if fn else (404, {})
diff --git a/tests/fixtures/route-table-keys/api/library/auth.py b/tests/fixtures/route-table-keys/api/library/auth.py
new file mode 100644
index 0000000..9a01137
--- /dev/null
+++ b/tests/fixtures/route-table-keys/api/library/auth.py
@@ -0,0 +1,3 @@
+def login(event):
+ """Signs a reader in."""
+ return 200, {}
diff --git a/tests/fixtures/route-table-keys/api/library/books.py b/tests/fixtures/route-table-keys/api/library/books.py
new file mode 100644
index 0000000..5879396
--- /dev/null
+++ b/tests/fixtures/route-table-keys/api/library/books.py
@@ -0,0 +1,11 @@
+def newest():
+ return []
+
+
+def one(book_id):
+ return {"id": book_id}
+
+
+def lend(event, book_id):
+ """Lends a book to the signed-in reader."""
+ return 201, {}
diff --git a/tests/fixtures/route-table-keys/api/library/one_off.py b/tests/fixtures/route-table-keys/api/library/one_off.py
new file mode 100644
index 0000000..9d6991c
--- /dev/null
+++ b/tests/fixtures/route-table-keys/api/library/one_off.py
@@ -0,0 +1,4 @@
+# A single entry is not a route table.
+REDIRECTS = {
+ "GET /old-catalogue": list,
+}
diff --git a/tests/fixtures/route-table-keys/api/library/rules.py b/tests/fixtures/route-table-keys/api/library/rules.py
new file mode 100644
index 0000000..b3c06bc
--- /dev/null
+++ b/tests/fixtures/route-table-keys/api/library/rules.py
@@ -0,0 +1,13 @@
+"""Who may call what. Keyed like the route table, but these values are access levels, not handlers."""
+PUBLIC, SIGNED_IN = "public", "signed-in"
+
+LEVELS = {
+ "GET /api/books": PUBLIC,
+ "GET /api/books/{book_id}": PUBLIC,
+ "POST /api/books/{book_id}/loans": SIGNED_IN,
+}
+
+NOTES = {
+ "GET /api/books": "cached for a minute",
+ "POST /api/login": "rate limited",
+}
diff --git a/tests/fixtures/route-table-keys/shop/auth.js b/tests/fixtures/route-table-keys/shop/auth.js
new file mode 100644
index 0000000..c29d426
--- /dev/null
+++ b/tests/fixtures/route-table-keys/shop/auth.js
@@ -0,0 +1 @@
+export const requireAuth = (fn) => (req, res) => (req.headers.authorization ? fn(req, res) : res.writeHead(401).end());
diff --git a/tests/fixtures/route-table-keys/shop/orders.js b/tests/fixtures/route-table-keys/shop/orders.js
new file mode 100644
index 0000000..db2cc9a
--- /dev/null
+++ b/tests/fixtures/route-table-keys/shop/orders.js
@@ -0,0 +1,3 @@
+export function listOrders(req, res) { res.end('[]'); }
+export function createOrder(req, res) { res.end('{}'); }
+export function getOrder(req, res) { res.end('{}'); }
diff --git a/tests/fixtures/route-table-keys/shop/server.js b/tests/fixtures/route-table-keys/shop/server.js
new file mode 100644
index 0000000..d247e1c
--- /dev/null
+++ b/tests/fixtures/route-table-keys/shop/server.js
@@ -0,0 +1,15 @@
+// Plain Node server: a lookup keyed by method and path, no framework.
+import http from 'node:http';
+import { listOrders, createOrder, getOrder } from './orders.js';
+import { requireAuth } from './auth.js';
+
+const routes = {
+ 'GET /api/orders': listOrders,
+ 'POST /api/orders': requireAuth(createOrder),
+ 'GET /api/orders/:id': (req, res) => getOrder(req, res),
+};
+
+http.createServer((req, res) => {
+ const handler = routes[`${req.method} ${new URL(req.url, 'http://x').pathname}`];
+ if (handler) handler(req, res); else res.writeHead(404).end();
+}).listen(3000);
diff --git a/tests/fixtures/route-table-keys/web/src/api.js b/tests/fixtures/route-table-keys/web/src/api.js
new file mode 100644
index 0000000..d63b835
--- /dev/null
+++ b/tests/fixtures/route-table-keys/web/src/api.js
@@ -0,0 +1,7 @@
+const API = import.meta.env.VITE_API_URL;
+
+export const books = () => fetch(`${API}/api/books`).then((r) => r.json());
+export const book = (id) => fetch(`${API}/api/books/${id}`).then((r) => r.json());
+export const borrow = (id) => fetch(`${API}/api/books/${id}/loans`, { method: 'POST' });
+export const orders = () => fetch('/api/orders').then((r) => r.json());
+export const placeOrder = (body) => fetch('/api/orders', { method: 'POST', body: JSON.stringify(body) });
diff --git a/tests/route-table-keys.test.mjs b/tests/route-table-keys.test.mjs
new file mode 100644
index 0000000..febd812
--- /dev/null
+++ b/tests/route-table-keys.test.mjs
@@ -0,0 +1,63 @@
+// Route tables keyed by "METHOD /path" (#54): a server without a framework keeps its endpoints in a
+// lookup a dispatcher reads ({ "GET /api/orders": listOrders } in JS, a dict of handlers in Python).
+// The keys are the endpoints, the website's requests reach them, and Health stays quiet about their
+// sign-in because the dispatcher or the handler checks it, out of sight of a per-route reading.
+import { test, before, after } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import path from 'node:path';
+import { REPO, lib, makeProject, run, readGraph, routeKeys, openEndpoints, cleanup } from './helpers.mjs';
+
+const { extract } = await lib('extract.mjs');
+
+let root, graph;
+before(() => {
+ root = makeProject({}, { arch: {
+ project: { name: 'route-table-keys', summary: 'Test fixture.' },
+ nodes: [
+ { id: 'web', label: 'Website', kind: 'ui', summary: 'The website.', paths: ['web/**'] },
+ { id: 'api', label: 'Library server', kind: 'service', summary: 'Python server.', paths: ['api/**'] },
+ { id: 'shop', label: 'Shop server', kind: 'service', summary: 'Node server.', paths: ['shop/**'] },
+ ],
+ } });
+ fs.cpSync(path.join(REPO, 'tests', 'fixtures', 'route-table-keys'), root, { recursive: true });
+ run('scan.mjs', root);
+ run('build.mjs', root, '--no-claude-md');
+ graph = readGraph(root);
+});
+after(() => cleanup(root));
+
+test('the keys of a Python and a JS route table are endpoints; tables of other values are not', () => {
+ assert.deepEqual(routeKeys(graph), [
+ 'GET /api/books', 'GET /api/books/{book_id}', 'GET /api/orders', 'GET /api/orders/:id', 'GET /api/status',
+ 'POST /api/books/{book_id}/loans', 'POST /api/login', 'POST /api/orders',
+ ]);
+ const files = new Set(graph.routes.map((r) => r.f));
+ assert.deepEqual([...files].sort(), ['api/library/app.py', 'shop/server.js']);
+});
+
+test('each entry names its handler: a function, a module function, a lambda that calls one, a wrapped one', () => {
+ const py = extract(fs.readFileSync(path.join(root, 'api/library/app.py'), 'utf8'), 'python', 'api/library/app.py');
+ assert.deepEqual(py.routes.map((r) => `${r.method} ${r.path} ${r.handler}`), [
+ 'GET /api/books list_books', 'GET /api/books/{book_id} get_book', 'POST /api/books/{book_id}/loans lend',
+ 'POST /api/login login', 'GET /api/status health',
+ ]);
+ // the handler's docstring is the route's, not the next def's after the table
+ assert.equal(py.routes.find((r) => r.path === '/api/books').doc, 'The whole catalogue, newest first.');
+ const js = extract(fs.readFileSync(path.join(root, 'shop/server.js'), 'utf8'), 'javascript', 'shop/server.js');
+ assert.deepEqual(js.routes.map((r) => `${r.method} ${r.path} ${r.handler}`), [
+ 'GET /api/orders listOrders', 'POST /api/orders createOrder', 'GET /api/orders/:id getOrder',
+ ]);
+});
+
+test("the website's requests reach the tables' endpoints", () => {
+ const http = graph.links.filter((l) => l.k === 'http').map((l) => `${l.a.slice(2)} -> ${l.b.slice(2)} ${l.labels.join(', ')}`).sort();
+ assert.deepEqual(http, [
+ 'web/src/api.js -> api/library/app.py GET /api/books, GET /api/books/{book_id}, POST /api/books/{book_id}/loans',
+ 'web/src/api.js -> shop/server.js GET /api/orders, POST /api/orders',
+ ]);
+});
+
+test('Health does not call table endpoints open: their sign-in check is out of its sight', () => {
+ assert.deepEqual(openEndpoints(graph), []);
+});