feat(db): add Drizzle ORM with local SQLite storage
Configure Bun SQLite with WAL mode, foreign keys, and a shared database path for development and production. Add migration commands and startup migration handling, check database connectivity in the health endpoint, and document configuration while excluding local database files from Git.
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
import { Hono } from "hono";
|
||||
import { sql } from "drizzle-orm";
|
||||
import { db } from "./db";
|
||||
import index from "./index.html";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
app.get("/api/health", c => c.json({ status: "ok" }));
|
||||
app.get("/api/health", c => {
|
||||
db.get(sql`SELECT 1`);
|
||||
return c.json({ status: "ok" });
|
||||
});
|
||||
app.notFound(c => c.json({ error: "Not found" }, 404));
|
||||
|
||||
const server = Bun.serve({
|
||||
|
||||
Reference in New Issue
Block a user