replace vanilla TS + Bun.serve() + MariaDB with: - frontend: React 19, Vite 6, TanStack Router/Query, Tailwind v4 - backend: Hono + @hono/node-server, Drizzle ORM, PostgreSQL, Zod - shared: algorithm, round-state, types in src/shared/ - tooling: Biome (lint/format), Vitest (tests) - deploy: static files at /movie-select/, API at /movie-select/api URL scheme changes from /movies/ to /movie-select/, API from action-based to RESTful endpoints. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 lines
516 B
TypeScript
21 lines
516 B
TypeScript
import { Hono } from "hono";
|
|
import { cors } from "hono/cors";
|
|
import { roundsRouter } from "./features/rounds/router.ts";
|
|
import { ApiError } from "./features/rounds/service.ts";
|
|
|
|
const app = new Hono();
|
|
|
|
app.use("*", cors());
|
|
|
|
app.route("/api/rounds", roundsRouter);
|
|
|
|
app.onError((err, c) => {
|
|
if (err instanceof ApiError) {
|
|
return c.json({ ok: false, error: err.message }, err.status as 400);
|
|
}
|
|
console.error(err);
|
|
return c.json({ ok: false, error: "Internal server error" }, 500);
|
|
});
|
|
|
|
export default app;
|