Final Phase C batch: moves the remaining inline route bodies (12 proxy stubs, /changelog, the webhooks/hijacks group, PDF export, ASPA adoption tracker + IPv6 stats endpoints) into server/routes/*.js and server/services/api-proxy.js, verified byte-for-byte via the smoke-test diff. Also drops the now-duplicate proxyToApiServer()/API_SERVER_PORT that were left behind in server.js after api-proxy.js absorbed them. server.js: 6838 -> 578 lines, under the 800-line project limit.
31 lines
931 B
JavaScript
31 lines
931 B
JavaScript
const { proxyToApiServer } = require("../services/api-proxy");
|
|
|
|
// Routes already migrated to the separate Fastify API server (src/api/ +
|
|
// src/features/*/routes.ts) -- forwarded through rather than reimplemented
|
|
// inline a second time. All mechanically identical (proxyToApiServer(req,
|
|
// res, req.url)); handled as one data-driven dispatch instead of 12
|
|
// near-duplicate one-line route handlers.
|
|
const EXACT_PATHS = new Set([
|
|
"/api/submarine-cables",
|
|
"/api/global-infra",
|
|
"/api/communities",
|
|
"/api/irr-audit",
|
|
"/api/asset-expand",
|
|
"/api/rpki-history",
|
|
"/api/aspath",
|
|
"/api/looking-glass",
|
|
"/api/ix-matrix",
|
|
"/changelog-data",
|
|
"/api/prefix-changes",
|
|
]);
|
|
|
|
function isProxyStubPath(reqPath) {
|
|
return EXACT_PATHS.has(reqPath) || reqPath.startsWith("/api/rib/");
|
|
}
|
|
|
|
function handleProxyStub(req, res) {
|
|
return proxyToApiServer(req, res, req.url);
|
|
}
|
|
|
|
module.exports = { isProxyStubPath, handleProxyStub };
|