Compare commits
2 Commits
fix/interm
...
fix/temp-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c04dc35075 | ||
| a41408559e |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "calendar-run-backend",
|
"name": "calendar-run-backend",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|||||||
@@ -7,6 +7,25 @@ import racesRouter from "./routes/races";
|
|||||||
export function createApp(): express.Express {
|
export function createApp(): express.Express {
|
||||||
const app = 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(
|
app.use(
|
||||||
cors({ origin: config.corsOrigin, methods: ["GET", "POST", "PATCH", "DELETE", "OPTIONS"] }),
|
cors({ origin: config.corsOrigin, methods: ["GET", "POST", "PATCH", "DELETE", "OPTIONS"] }),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user