init repo
This commit is contained in:
29
biz/handler.go
Normal file
29
biz/handler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package biz
|
||||
|
||||
import (
|
||||
"github.com/nose7en/ToyBoomServer/biz/user"
|
||||
"github.com/nose7en/ToyBoomServer/common"
|
||||
"github.com/nose7en/ToyBoomServer/config"
|
||||
"github.com/nose7en/ToyBoomServer/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Router() *gin.Engine {
|
||||
r := gin.Default()
|
||||
|
||||
api := r.Group("/api")
|
||||
v1 := api.Group("/v1")
|
||||
|
||||
userRouter := v1.Group("/user")
|
||||
{
|
||||
userRouter.POST("/create", middleware.ValidateAppleAppToken(), common.Wrapper(user.CreateUser))
|
||||
userRouter.GET("/info", middleware.ValidateAppleAppToken(), common.Wrapper(user.GetUserInfo))
|
||||
}
|
||||
|
||||
if config.IsDebug() {
|
||||
// for debug
|
||||
v1.GET("/ping", middleware.ValidateAppleAppToken(), func(ctx *gin.Context) { ctx.JSON(200, gin.H{"message": "pong"}) })
|
||||
}
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user