Documentation ¶
Overview ¶
Package app is the primary runtime service.
Index ¶
- Variables
- type Server
- func (srv *Server) Health(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (srv *Server) Hello(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (srv *Server) Ready(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (srv *Server) Run() error
- func (srv *Server) SetHello(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (srv *Server) Stop()
Constants ¶
This section is empty.
Variables ¶
var (
ErrShutdown = fmt.Errorf("application shutdown gracefully")
)
Common errors returned by this app.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the main server structure.
func New ¶
New creates a new instance of the Server struct. It takes a `cfg` parameter of type `*viper.Viper` for configuration. It returns a pointer to the created Server instance.
func (*Server) Health ¶
func (srv *Server) Health(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Health is used to handle HTTP Health requests to this service. Use this for liveness probes or any other checks which only validate if the services is running.
func (*Server) Hello ¶
func (srv *Server) Hello(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Hello will handle any requests to /hello with a greating.
func (*Server) Ready ¶
func (srv *Server) Ready(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Ready is used to handle HTTP Ready requests to this service. Use this for readiness probes or any checks that validate the service is ready to accept traffic.
func (*Server) Run ¶
Run starts the primary application. It handles starting background services, populating package globals & structures, and clean up tasks.
func (*Server) SetHello ¶
func (srv *Server) SetHello(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
SetHello will handle any update requests to /hello to store our greating.