fix: phase 1 bugs — CSS tokens, pluralization, error handling, cross-platform tests
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
- Add missing --space-1 CSS token used by filter and detail components - Fix active nav link losing styles on hover (CSS specificity) - Correct Russian day pluralization (21 день, 22 дня, 25 дней) - Show filter error banner even when stale race data is present - Add cross-env for Windows-compatible npm test - Add global JSON error handler in Express for malformed request bodies - Replace stateless mock DB with in-memory store for correct DELETE/UPDATE behavior Made-with: Cursor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import express from "express";
|
||||
import express, { Request, Response, NextFunction } from "express";
|
||||
import cors from "cors";
|
||||
import { config } from "./config";
|
||||
import healthRouter from "./routes/health";
|
||||
@@ -13,5 +13,14 @@ export function createApp(): express.Express {
|
||||
app.use(healthRouter);
|
||||
app.use(racesRouter);
|
||||
|
||||
app.use((err: unknown, _req: Request, res: Response, _next: NextFunction) => {
|
||||
if (err instanceof SyntaxError && "body" in err) {
|
||||
res.status(400).json({ error: "validation_error", details: ["Invalid JSON in request body"] });
|
||||
return;
|
||||
}
|
||||
console.error("[app] Unhandled error:", err);
|
||||
res.status(500).json({ error: "unknown_error", details: ["Internal server error"] });
|
||||
});
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user