forked from HammerCloth/tiktok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
router.go
27 lines (25 loc) · 1.11 KB
/
router.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"TikTok/controller"
"TikTok/middleware/jwt"
"github.com/gin-gonic/gin"
)
func initRouter(r *gin.Engine) {
apiRouter := r.Group("/douyin")
// basic apis
apiRouter.GET("/feed/", jwt.AuthWithoutLogin(), controller.Feed)
apiRouter.POST("/publish/action/", jwt.AuthBody(), controller.Publish)
apiRouter.GET("/publish/list/", jwt.Auth(), controller.PublishList)
apiRouter.GET("/user/", jwt.Auth(), controller.UserInfo)
apiRouter.POST("/user/register/", controller.Register)
apiRouter.POST("/user/login/", controller.Login)
// extra apis - I
apiRouter.POST("/favorite/action/", jwt.Auth(), controller.FavoriteAction)
apiRouter.GET("/favorite/list/", jwt.Auth(), controller.GetFavouriteList)
apiRouter.POST("/comment/action/", jwt.Auth(), controller.CommentAction)
apiRouter.GET("/comment/list/", jwt.AuthWithoutLogin(), controller.CommentList)
// extra apis - II
apiRouter.POST("/relation/action/", jwt.Auth(), controller.RelationAction)
apiRouter.GET("/relation/follow/list/", jwt.Auth(), controller.GetFollowing)
apiRouter.GET("/relation/follower/list", jwt.Auth(), controller.GetFollowers)
}