Documentation ¶
Index ¶
- func DocHandler(name string, assets *Assets) http.HandlerFunc
- func FileHandler(cfg *config.Config, database db.DB, tmpl *template.Template) http.HandlerFunc
- func HealthHandler(w http.ResponseWriter, _ *http.Request)
- func IsSignedAndNotExpired(s *signer.Signer, r *http.Request) bool
- func MetaHandler(cfg *config.Config) http.HandlerFunc
- func ShouldSendRaw(r *http.Request) bool
- func WithLogger(next http.Handler) http.Handler
- func WithMiddleware(handler http.Handler, middlewares ...Middleware) http.Handler
- func WithRecover(next http.Handler) http.Handler
- func WithRequestID(next http.Handler) http.Handler
- type Assets
- func (a *Assets) CSS() []byte
- func (a *Assets) Doc(filename string) ([]byte, error)
- func (a *Assets) JS() []byte
- func (a *Assets) ReadME() []byte
- func (a *Assets) ServeCSS(w http.ResponseWriter, r *http.Request)
- func (a *Assets) ServeJS(w http.ResponseWriter, r *http.Request)
- func (a *Assets) Template() *template.Template
- type ContextKey
- type Middleware
- type Router
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DocHandler ¶
func DocHandler(name string, assets *Assets) http.HandlerFunc
func FileHandler ¶
func HealthHandler ¶
func HealthHandler(w http.ResponseWriter, _ *http.Request)
func MetaHandler ¶
func MetaHandler(cfg *config.Config) http.HandlerFunc
func ShouldSendRaw ¶
func WithLogger ¶
WithLogger adds a request scoped logger to the request context.
func WithMiddleware ¶
func WithMiddleware(handler http.Handler, middlewares ...Middleware) http.Handler
WithMiddleware is a helper function to apply multiple middlewares to a handler.
func WithRecover ¶
WithRecover will recover from any panics and log them.
Types ¶
type Assets ¶
type Assets struct {
// contains filtered or unexported fields
}
type ContextKey ¶
type ContextKey string
const ( RequestIDContextKey ContextKey = "request_id" RequestIDHeader = "X-Request-ID" )
type Router ¶
func (*Router) HandleFunc ¶
Click to show internal directories.
Click to hide internal directories.