You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/oa/main.go

42 lines
701 B
Go

//
// main.go
// Copyright (C) 2024 veypi <i@veypi.com>
// 2024-09-20 16:10:16
// Distributed under terms of the MIT license.
//
package main
import (
"oa/api"
"oa/cfg"
2 months ago
"oa/errs"
_ "oa/models"
"github.com/veypi/OneBD/rest"
"github.com/veypi/utils/logv"
)
func main() {
cfg.CMD.Command = runWeb
cfg.CMD.Parse()
err := cfg.CMD.Run()
if err != nil {
logv.Warn().Msg(err.Error())
}
}
func runWeb() error {
1 month ago
go cfg.RunNats()
app, err := rest.New(&cfg.Config.RestConf)
if err != nil {
return err
}
apiRouter := app.Router().SubRouter("api")
api.Use(apiRouter)
2 months ago
apiRouter.Use(errs.JsonResponse)
apiRouter.SetErrFunc(errs.JsonErrorResponse)
app.Router().Print()
return app.Run()
}