44 lines
916 B
Go
Raw Normal View History

2024-04-07 18:12:24 +08:00
package main
import (
"log"
"github.com/gin-gonic/gin"
2024-04-08 23:50:49 +08:00
"github.com/iapologizewhenimwrong/Vestmore_GO/server/app/internal/handlers/account"
2024-04-09 13:38:29 +08:00
"github.com/iapologizewhenimwrong/Vestmore_GO/server/app/internal/handlers/actions"
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/cors"
2024-04-08 18:13:01 +08:00
_ "github.com/go-sql-driver/mysql"
2024-04-07 18:12:24 +08:00
)
2024-04-08 23:50:49 +08:00
func AppV1_0(ctx *gin.Context) {
2024-04-07 18:12:24 +08:00
if actionKey, ok := ctx.GetPostForm("action"); ok {
2024-04-08 18:13:01 +08:00
// if token, ok := ctx.GetPostForm("token"); ok {
2024-04-09 13:38:29 +08:00
log.Println(actionKey)
2024-04-08 18:13:01 +08:00
// }
2024-04-09 13:38:29 +08:00
actions.HandlersFuncRoutes[actionKey](ctx)
2024-04-08 23:50:49 +08:00
return
2024-04-07 18:12:24 +08:00
}
2024-04-08 23:50:49 +08:00
2024-04-07 18:12:24 +08:00
}
func main() {
2024-04-09 13:38:29 +08:00
log.SetFlags(log.Llongfile)
2024-04-10 14:58:19 +08:00
2024-04-07 18:12:24 +08:00
r := gin.Default()
2024-04-09 13:38:29 +08:00
cors.SetCors(r)
2024-04-07 18:12:24 +08:00
2024-04-08 23:50:49 +08:00
app_1_0 := r.Group("app")
account_1_0 := app_1_0.Group("account")
2024-04-09 13:38:29 +08:00
account_1_0.POST("/register_with_email", account.RegisterWithEmailCode)
2024-04-07 18:12:24 +08:00
2024-04-08 23:50:49 +08:00
app_1_0.POST("/1_0", AppV1_0)
2024-04-09 13:38:29 +08:00
for k := range actions.HandlersFuncRoutes {
2024-04-08 23:50:49 +08:00
log.Printf("api action %s", k)
2024-04-07 18:12:24 +08:00
}
2024-04-09 13:38:29 +08:00
r.Run(":9999")
2024-04-07 18:12:24 +08:00
}