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

41 lines
683 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"
4 weeks 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 {
app, err := rest.New(&cfg.Config.RestConf)
if err != nil {
return err
}
apiRouter := app.Router().SubRouter("api")
api.Use(apiRouter)
4 weeks ago
apiRouter.Use(errs.JsonResponse)
apiRouter.SetErrFunc(errs.JsonErrorResponse)
app.Router().Print()
return app.Run()
}