cleaning up api

This commit is contained in:
2025-03-12 15:49:47 +08:00
parent 285a0c780a
commit 9d7d1abb49
10 changed files with 1974 additions and 839 deletions

View File

@@ -1,14 +1,16 @@
import { Hono } from 'hono';
import { getComments, createComment, deleteComment } from '../controllers/commentsController';
import { authMiddleware } from '../middlewares/auth';
import { getComments, getCommentById, createComment, updateComment, deleteComment } from '../controllers/commentsController';
const commentsRouter = new Hono();
// Public routes
commentsRouter.get('/', getComments);
commentsRouter.get('/:comment_id', getCommentById);
// Protected routes
commentsRouter.post('/', authMiddleware, createComment);
commentsRouter.put('/:comment_id', authMiddleware, updateComment);
commentsRouter.delete('/:comment_id', authMiddleware, deleteComment);
export default commentsRouter;