Documentation ¶
Index ¶
- func NewHTTPMux(router *Router, errorHandler *ErrorHandler) *http.ServeMux
- func NewHTTPServer(lc fx.Lifecycle, mux *http.ServeMux) *http.Server
- func RetrieveErrorCode(err error) int
- func ServeStaticAssets(fs embed.FS) func(r *Router)
- func Validate[T interface{}](ctx *CaesarCtx) (data *T, validationErrors map[string]string, ok bool)
- func ValidateEnvironmentVariables[T interface{}]() *T
- type App
- type AppConfig
- type CaesarCtx
- func (c *CaesarCtx) Context() context.Context
- func (c *CaesarCtx) DecodeJSON(v any) error
- func (ctx *CaesarCtx) GetHeader(key string) string
- func (c *CaesarCtx) PathValue(key string) string
- func (ctx *CaesarCtx) Redirect(to string) error
- func (c *CaesarCtx) Render(component templ.Component) error
- func (c *CaesarCtx) SendJSON(v interface{}, statuses ...int) error
- func (c *CaesarCtx) SendText(text string, statuses ...int) error
- func (ctx *CaesarCtx) SetHeader(key string, value string)
- func (c *CaesarCtx) WithStatus(statusCode int) *CaesarCtx
- type Error
- type ErrorHandler
- type Handler
- type Route
- type Router
- func (r *Router) Any(pattern string, handler Handler) *Route
- func (r *Router) Delete(pattern string, handler Handler) *Route
- func (r *Router) Get(pattern string, handler Handler) *Route
- func (r *Router) Patch(pattern string, handler Handler) *Route
- func (r *Router) Post(pattern string, handler Handler) *Route
- func (r *Router) Put(pattern string, handler Handler) *Route
- func (r *Router) Render(pattern string, component templ.Component) *Route
- func (r *Router) Use(handler Handler)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPMux ¶
func NewHTTPMux(router *Router, errorHandler *ErrorHandler) *http.ServeMux
func RetrieveErrorCode ¶
func ServeStaticAssets ¶
ServeStaticAssets returns a provider, which serves static assets from the embed.FS.
func Validate ¶
Validate validates the request body or form values. It returns the data, the validation errors, and a boolean indicating if the data is valid.
func ValidateEnvironmentVariables ¶
func ValidateEnvironmentVariables[T interface{}]() *T
ValidateEnvironmentVariables validates the environment variables, and panics if any of the environment variables aren't correctly set.
Types ¶
type App ¶
func (*App) RegisterInvokers ¶
func (*App) RegisterProviders ¶
func (*App) RetrieveRouter ¶
type CaesarCtx ¶
type CaesarCtx struct { ResponseWriter http.ResponseWriter Request *http.Request // contains filtered or unexported fields }
CaesarCtx is a wrapper around http.ResponseWriter and *http.Request, that is augmented with some Caesar-specific methods.
func (*CaesarCtx) DecodeJSON ¶
DecodeJSON decodes the JSON body of the request into the provided value.
func (*CaesarCtx) WithStatus ¶
type ErrorHandler ¶
type Router ¶
Click to show internal directories.
Click to hide internal directories.