init repo

This commit is contained in:
VaalaCat
2024-08-28 00:02:28 +08:00
committed by vaalacat
commit 13148b95e3
97 changed files with 10214 additions and 0 deletions

29
biz/handler.go Normal file
View 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
}