Compare commits

..

2 Commits

Author SHA1 Message Date
Vaka.pro
c04dc35075 chore(backend): log Host/Origin and status for request debugging
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
2026-04-10 22:26:53 +03:00
a41408559e Merge pull request 'refactor(api): unify /api contract across frontend, nginx, and backend' (#18) from fix/intermittent-api-retry-cache into main
Some checks failed
CI / build-and-test (push) Has been cancelled
Reviewed-on: #18
2026-04-08 09:19:43 +00:00
2 changed files with 20 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "calendar-run-backend",
"version": "1.2.0",
"version": "1.2.1",
"private": true,
"scripts": {
"build": "tsc",

View File

@@ -7,6 +7,25 @@ import racesRouter from "./routes/races";
export function createApp(): express.Express {
const app = express();
// TEMP: compare Host vs Origin for 200 vs 401 debugging — remove when done
app.use((req, res, next) => {
const host = req.headers.host;
const origin = req.headers.origin;
res.on("finish", () => {
console.log(
JSON.stringify({
tag: "temp-req-headers",
host,
origin: origin ?? null,
method: req.method,
path: req.originalUrl ?? req.url,
status: res.statusCode,
}),
);
});
next();
});
app.use(
cors({ origin: config.corsOrigin, methods: ["GET", "POST", "PATCH", "DELETE", "OPTIONS"] }),
);