feat(backend): cards CRUD service and routes
This commit is contained in:
@@ -2,6 +2,7 @@ import express, { type Express, type NextFunction, type Request, type Response }
|
||||
import { ZodError } from 'zod';
|
||||
import type { Db } from './db/client.js';
|
||||
import { ApiError } from './lib/errors.js';
|
||||
import { cardsRouter } from './routes/cards.js';
|
||||
import { lessonsRouter } from './routes/lessons.js';
|
||||
|
||||
export function createApp(db: Db): Express {
|
||||
@@ -10,6 +11,7 @@ export function createApp(db: Db): Express {
|
||||
|
||||
app.get('/api/health', (_req, res) => res.json({ ok: true }));
|
||||
app.use('/api/lessons', lessonsRouter(db));
|
||||
app.use('/api', cardsRouter(db));
|
||||
|
||||
app.use((err: unknown, _req: Request, res: Response, _next: NextFunction) => {
|
||||
if (err instanceof ZodError) {
|
||||
|
||||
Reference in New Issue
Block a user