Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component interface {
Stop()
}
Component defines long-running services within the http service that require graceful shutdown when service shuts down.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(opt ...ServiceOpt) *Service
func (*Service) Component ¶
Component registers a Component that will run within the service that requires stopping when service shuts down.
func (*Service) Register ¶
func (s *Service) Register(path, method string, routeHandler http.Handler, preHandler ...negroni.Handler)
Register registers a route-handler (http.Handler) for a given path and http.Method. Pre-handler(s) can optionally be supplied, they will run before route-handler in the order supplied.
type ServiceOpt ¶
type ServiceOpt func(*serviceOpts)
func App ¶
func App(app ...func(*Service) error) ServiceOpt
func ServiceName ¶
func ServiceName(name string) ServiceOpt
func ServicePort ¶
func ServicePort(port int) ServiceOpt
func ServiceShutdownGracetime ¶
func ServiceShutdownGracetime(t time.Duration) ServiceOpt
Click to show internal directories.
Click to hide internal directories.