app

package
v0.0.0-...-ff46bab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package app is the primary runtime service.

Index

Constants

This section is empty.

Variables

View Source
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

func New(cfg *viper.Viper) *Server

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

func (srv *Server) Run() error

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.

func (*Server) Stop

func (srv *Server) Stop()

Stop is used to gracefully shutdown the server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL