Documentation ¶
Overview ¶
Package web contains a small web framework for building services.
Index ¶
- func GetTraceID(ctx context.Context) string
- func IsShutdownError(err error) bool
- func NewShutdownError(message string) error
- func Respond(ctx context.Context, w http.ResponseWriter, data any, statusCode int) error
- func SetStatusCode(ctx context.Context, statusCode int)
- type App
- type Handler
- type Middleware
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTraceID ¶
func IsShutdownError ¶
func NewShutdownError ¶
func SetStatusCode ¶
Types ¶
type App ¶
type App struct { *httptreemux.ContextMux // contains filtered or unexported fields }
App is the entrypoint into our application and what configures our context.
func NewApp ¶
func NewApp(shutdown chan os.Signal, mw ...Middleware) *App
NewApp constructs an App value to handle a set of routes for the application.
func (*App) Handle ¶
func (a *App) Handle(method string, path string, handler Handler, mw ...Middleware)
Handle sets a handler function for a given HTTP method and path pair to the application server mux.
func (*App) SignalShutdown ¶
func (a *App) SignalShutdown()
type Middleware ¶
Middleware is a function that wraps a handler to perform pre/post processing.
Click to show internal directories.
Click to hide internal directories.