feat(20-01): add tags table, tag service/route, register global-items route
- Create tags table in schema with id, name (unique), createdAt - Generate migration for tags table - Create tag.service.ts with getAllTags (id+name, alphabetical order) - Create tags.ts route with GET / handler - Register /api/global-items and /api/tags routes in index.ts - Add auth skip for GET /api/tags and GET /api/global-items
This commit is contained in:
14
src/server/routes/tags.ts
Normal file
14
src/server/routes/tags.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Hono } from "hono";
|
||||
import { getAllTags } from "../services/tag.service.ts";
|
||||
|
||||
type Env = { Variables: { db?: any } };
|
||||
|
||||
const app = new Hono<Env>();
|
||||
|
||||
app.get("/", async (c) => {
|
||||
const db = c.get("db");
|
||||
const allTags = await getAllTags(db);
|
||||
return c.json(allTags);
|
||||
});
|
||||
|
||||
export { app as tagRoutes };
|
||||
Reference in New Issue
Block a user