Documentation ¶
Index ¶
- func DocHandler(assets Assets) http.HandlerFunc
- func FileHandler(cfg *config.Config, database db.DB, assets Assets) http.HandlerFunc
- func HealthHandler(w http.ResponseWriter, _ *http.Request)
- func MetaHandler(cfg *config.Config) http.HandlerFunc
- func ShouldSendRaw(r *http.Request) bool
- func WithLogger(next http.Handler) http.Handler
- func WithMetrics(next http.Handler) http.Handler
- func WithRecover(next http.Handler) http.Handler
- func WithRequestID(next http.Handler) http.Handler
- type Assets
- type ContextKey
- type Service
- type StaticAssets
- func (a *StaticAssets) CSS() []byte
- func (a *StaticAssets) Doc(filename string) ([]byte, error)
- func (a *StaticAssets) JS() []byte
- func (a *StaticAssets) README() []byte
- func (a *StaticAssets) ServeCSS(w http.ResponseWriter, r *http.Request)
- func (a *StaticAssets) ServeJS(w http.ResponseWriter, r *http.Request)
- func (a *StaticAssets) Template() *template.Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DocHandler ¶
func DocHandler(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 WithMetrics ¶ added in v0.3.0
WithMetrics will record metrics for the request.
func WithRecover ¶
WithRecover will recover from any panics and log them.
Types ¶
type ContextKey ¶
type ContextKey string
const ( RequestIDContextKey ContextKey = "request_id" RequestIDHeader = "X-Request-ID" )
type StaticAssets ¶ added in v0.3.0
type StaticAssets struct {
// contains filtered or unexported fields
}
func NewAssets ¶
func NewAssets(webFS fs.FS, docsFS fs.FS, readme []byte, extendHeadFile string) (*StaticAssets, error)
NewAssets holds the templates, static content and minifies accordingly.
func (*StaticAssets) CSS ¶ added in v0.3.0
func (a *StaticAssets) CSS() []byte
func (*StaticAssets) Doc ¶ added in v0.3.0
func (a *StaticAssets) Doc(filename string) ([]byte, error)
func (*StaticAssets) JS ¶ added in v0.3.0
func (a *StaticAssets) JS() []byte
func (*StaticAssets) README ¶ added in v0.3.0
func (a *StaticAssets) README() []byte
func (*StaticAssets) ServeCSS ¶ added in v0.3.0
func (a *StaticAssets) ServeCSS(w http.ResponseWriter, r *http.Request)
func (*StaticAssets) ServeJS ¶ added in v0.3.0
func (a *StaticAssets) ServeJS(w http.ResponseWriter, r *http.Request)
func (*StaticAssets) Template ¶ added in v0.3.0
func (a *StaticAssets) Template() *template.Template
Click to show internal directories.
Click to hide internal directories.