- Settings API: GET/PUT /api/settings/:key with SQLite persistence - useSettings hook with TanStack Query for settings CRUD - OnboardingWizard: 3-step modal overlay (welcome, create category, add item) - Root layout checks onboarding completion flag before rendering wizard - Skip option available at every step, all paths persist completion to DB Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { Hono } from "hono";
|
|
import { serveStatic } from "hono/bun";
|
|
import { seedDefaults } from "../db/seed.ts";
|
|
import { itemRoutes } from "./routes/items.ts";
|
|
import { categoryRoutes } from "./routes/categories.ts";
|
|
import { totalRoutes } from "./routes/totals.ts";
|
|
import { imageRoutes } from "./routes/images.ts";
|
|
import { settingsRoutes } from "./routes/settings.ts";
|
|
|
|
// Seed default data on startup
|
|
seedDefaults();
|
|
|
|
const app = new Hono();
|
|
|
|
// Health check
|
|
app.get("/api/health", (c) => {
|
|
return c.json({ status: "ok" });
|
|
});
|
|
|
|
// API routes
|
|
app.route("/api/items", itemRoutes);
|
|
app.route("/api/categories", categoryRoutes);
|
|
app.route("/api/totals", totalRoutes);
|
|
app.route("/api/images", imageRoutes);
|
|
app.route("/api/settings", settingsRoutes);
|
|
|
|
// Serve uploaded images
|
|
app.use("/uploads/*", serveStatic({ root: "./" }));
|
|
|
|
// Serve Vite-built SPA in production
|
|
if (process.env.NODE_ENV === "production") {
|
|
app.use("/*", serveStatic({ root: "./dist/client" }));
|
|
app.get("*", serveStatic({ path: "./dist/client/index.html" }));
|
|
}
|
|
|
|
export default { port: 3000, fetch: app.fetch };
|
|
export { app };
|