16 lines
600 B
TypeScript
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;
|