package main
import (
"github.com/gin-gonic/gin"
"topic.jtthink.com/src"
)
func main() {
router := gin.Default()
v1 := router.Group("/v1/topics")
{
v1.GET("", src.GetTopicList)
v1.GET("/:topic_id", src.GetTopicDetail)
v1.Use(src.MustLogin()) //当使用了mustlogin,在下方定义的一切路由都需要先经过他验证
v1.POST("", src.NewTopic)
v1.DELETE("/:topic_id", src.DelTopic)
router.Run()
}
}
原文地址:https://www.cnblogs.com/hualou/p/12071046.html
时间: 2024-10-17 13:36:56