// Code generated by hertz generator. package main import ( "os" "gitea.timerzz.com/onecat/user/biz/router/healthz" "gitea.timerzz.com/onecat/user/biz/router/user" "gitea.timerzz.com/onecat/user/pkg/captcha" "gitea.timerzz.com/onecat/user/pkg/pgsql" "gitea.timerzz.com/onecat/user/pkg/wx" "github.com/ArtisanCloud/PowerWeChat/v3/src/miniProgram" "github.com/cloudwego/hertz/pkg/app/server" "github.com/hertz-contrib/cors" "gorm.io/gorm" ) func register(h *server.Hertz, db *gorm.DB, miniProgramApp *miniProgram.MiniProgram, captchaService captcha.Service) { user.Register(h, db, miniProgramApp, captchaService) healthz.NewHealthz().Registry(h) } // @title 用户和登录相关接口 // @version 1.0 // @description 这是一个用户和登录相关的接口文档 // @contact.name oneCat-user // @license.name Apache 2.0 // @license.url http://www.apache.org/licenses/LICENSE-2.0.html // @BasePath / // @schemes http func main() { port := ":80" if os.Getenv("PORT") != "" { port = os.Getenv("PORT") } h := server.Default(server.WithHostPorts(port)) h.Use(cors.New(cors.Config{ AllowAllOrigins: true, AllowMethods: []string{"GET", "POST"}, ExposeHeaders: []string{"Content-Length"}, AllowHeaders: []string{"Origin", "Authorization", "Content-Type"}, AllowCredentials: true, })) db := pgsql.InitDB() miniProgramApp := wx.NewWX() captchaService := captcha.InitDefaultService() defer captchaService.Close() register(h, db, miniProgramApp, captchaService) h.Spin() }