RegisterRoutes 注册路由
(server *gin.Engine)
| 24 | |
| 25 | // RegisterRoutes 注册路由 |
| 26 | func (ch *CommentHandler) RegisterRoutes(server *gin.Engine) { |
| 27 | commentsGroup := server.Group("/api/comments") |
| 28 | commentsGroup.POST("/create", WrapBody(ch.CreateComment)) |
| 29 | commentsGroup.POST("/list", WrapBody(ch.ListComments)) |
| 30 | commentsGroup.DELETE("/delete/:commentId", WrapParam(ch.DeleteComment)) |
| 31 | commentsGroup.POST("/get_more", WrapBody(ch.GetMoreCommentReply)) |
| 32 | commentsGroup.POST("/get_top", WrapBody(ch.GetTopCommentReply)) |
| 33 | } |
| 34 | |
| 35 | // CreateComment 创建评论处理器方法 |
| 36 | func (ch *CommentHandler) CreateComment(ctx *gin.Context, req req.CreateCommentReq) (Result, error) { |