Vestmore_GO/server/app/main.go
2024-04-10 17:30:12 +08:00

44 lines
916 B
Go

package main
import (
"log"
"github.com/gin-gonic/gin"
"github.com/iapologizewhenimwrong/Vestmore_GO/server/app/internal/handlers/account"
"github.com/iapologizewhenimwrong/Vestmore_GO/server/app/internal/handlers/actions"
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/cors"
_ "github.com/go-sql-driver/mysql"
)
func AppV1_0(ctx *gin.Context) {
if actionKey, ok := ctx.GetPostForm("action"); ok {
// if token, ok := ctx.GetPostForm("token"); ok {
log.Println(actionKey)
// }
actions.HandlersFuncRoutes[actionKey](ctx)
return
}
}
func main() {
log.SetFlags(log.Llongfile)
r := gin.Default()
cors.SetCors(r)
app_1_0 := r.Group("app")
account_1_0 := app_1_0.Group("account")
account_1_0.POST("/register_with_email", account.RegisterWithEmailCode)
app_1_0.POST("/1_0", AppV1_0)
for k := range actions.HandlersFuncRoutes {
log.Printf("api action %s", k)
}
r.Run(":9999")
}