Vestmore_GO/server/app/main.go

44 lines
916 B
Go
Raw Normal View History

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