Documentation ¶
Index ¶
- Constants
- Variables
- type ApiServer
- func (srv *ApiServer) ListenAndServe() error
- func (srv *ApiServer) RegisterMiddleware(middlewares ...func(engine *gin.Engine))
- func (srv *ApiServer) RegisterRouters(routers ...func(engine *gin.Engine)) *ApiServer
- func (srv *ApiServer) RegisterService(handlers ...func(*ApiServer))
- func (srv *ApiServer) RegisterShutdown(handlers ...func(*ApiServer))
- func (srv *ApiServer) Shutdown(ctx context.Context)
- type Option
Constants ¶
View Source
const ( Version = "v1.1.0" ApiModule = "common/api-server" )
Variables ¶
View Source
var ( ApiOptions struct { flags.Options Environment string `short:"e" long:"env" description:"Use ApiServer environment" default:"testing"` Version bool `short:"v" long:"verbose" description:"Show ApiServer version"` EnablePProfile bool `short:"p" long:"enable-pprof" description:"enable pprof"` PProfilePort int `short:"d" long:"pprof-port" description:"pprof port" default:"8188"` EnableHealthCheck bool `short:"a" long:"enable-health-check" description:"enable health check"` HealthCheckURI string `short:"i" long:"health-check-uri" description:"health check uri" default:"/health" ` HealthCheckPort int `short:"f" long:"health-check-port" description:"health check port" default:"8186"` ConfigFileName string `short:"c" long:"config" description:"Use ApiServer config file" default:"main"` EnableDevMode bool `short:"m" long:"enable-dev-mode" description:"enable dev mode"` } )
Functions ¶
This section is empty.
Types ¶
type ApiServer ¶
type ApiServer struct { Engine *gin.Engine HttpServer *http.Server Addr string Routers []func(*gin.Engine) Middlewares []func(*gin.Engine) Shutdowns []func(*ApiServer) Services []func(*ApiServer) // contains filtered or unexported fields }
func NewApiServer ¶
func (*ApiServer) ListenAndServe ¶
ListenAndServe Listen And Serve()
func (*ApiServer) RegisterMiddleware ¶
Register Middleware Middleware
func (*ApiServer) RegisterRouters ¶
RegisterRouters
func (*ApiServer) RegisterService ¶
Register Service Handler
func (*ApiServer) RegisterShutdown ¶
Register Shutdown Handler
Click to show internal directories.
Click to hide internal directories.