Files
promote/backend/src/routes/comments.ts
2025-03-12 15:49:47 +08:00

16 lines
600 B
TypeScript

import { Hono } from 'hono';
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;