wool

package module
v0.0.0-...-16e9f1d Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 28 Imported by: 16

README

Wool Web Framework

License

Wool is a web framework written in Go (Golang).

Installation

To install Wool package, you need to install Go and set your Go workspace first.

  1. You first need Go installed, then you can use the below Go command to install Wool.
go get github.com/gowool/wool
  1. Import it in your code:
import "github.com/gowool/wool"
Running Wool
package main

import (
    "context"
    "net/http"
	"os"
    
    "github.com/gowool/middleware/proxy"
    "github.com/gowool/wool"
	"golang.org/x/exp/slog"
)

type crud struct {
}

func (*crud) List(c wool.Ctx) error {
    return c.JSON(http.StatusOK, "list")
}

func (*crud) Take(c wool.Ctx) error {
    return c.JSON(http.StatusOK, "take: " + c.Req().PathParamID())
}

func (*crud) Panic(c wool.Ctx) error {
    panic("panic message")
}

func main() {
	l := slog.New(slog.HandlerOptions{Level: slog.LevelDebug}.NewJSONHandler(os.Stdout))

	w := wool.New(l.WithGroup("wool"))
    w.Use(proxy.Middleware())
    w.MountHealth()
    
    crudHandlers := new(crud)
    
    w.Group("/api/v1", func(api *wool.Wool) {
        api.Group("/boards", func(b *wool.Wool) {
            b.GET("/panic", crudHandlers.Panic)
        })
        api.CRUD("/boards", crudHandlers)
    })
    
    srv := wool.NewServer(&wool.ServerConfig{
        Address: ":8080",
    }, l.WithGroup("server"))
    
    if err := srv.StartC(context.Background(), w); err != nil {
		srv.Log.Error("server error", "err", err)
		os.Exit(1)
    }
}

License

Distributed under MIT License, please see license file within the code for more details.

Documentation

Index

Constants

View Source
const (
	MIMETextXML         = "text/xml"
	MIMETextHTML        = "text/html"
	MIMETextPlain       = "text/plain"
	MIMETextJavaScript  = "text/javascript"
	MIMETextEventStream = "text/event-stream"
	MIMEApplicationXML  = "application/xml"
	MIMEApplicationJSON = "application/json"
	MIMEApplicationForm = "application/x-www-form-urlencoded"
	MIMEOctetStream     = "application/octet-stream"
	MIMEMultipartForm   = "multipart/form-data"
	MIMEImageIcon       = "image/x-icon"

	MIMETextXMLCharsetUTF8         = "text/xml; charset=utf-8"
	MIMETextHTMLCharsetUTF8        = "text/html; charset=utf-8"
	MIMETextPlainCharsetUTF8       = "text/plain; charset=utf-8"
	MIMETextJavaScriptCharsetUTF8  = "text/javascript; charset=utf-8"
	MIMETextEventStreamCharsetUTF8 = "text/event-stream; charset=utf-8"
	MIMEApplicationXMLCharsetUTF8  = "application/xml; charset=utf-8"
	MIMEApplicationJSONCharsetUTF8 = "application/json; charset=utf-8"
)

MIME types that are commonly used

View Source
const (
	HeaderAuthorization                   = "Authorization"
	HeaderProxyAuthenticate               = "Proxy-Authenticate"
	HeaderProxyAuthorization              = "Proxy-Authorization"
	HeaderWWWAuthenticate                 = "WWW-Authenticate"
	HeaderAge                             = "Age"
	HeaderCacheControl                    = "Cache-Control"
	HeaderClearSiteData                   = "Clear-Site-Data"
	HeaderExpires                         = "Expires"
	HeaderPragma                          = "Pragma"
	HeaderWarning                         = "Warning"
	HeaderAcceptCH                        = "Accept-CH"
	HeaderAcceptCHLifetime                = "Accept-CH-Lifetime"
	HeaderContentDPR                      = "Content-DPR"
	HeaderDPR                             = "DPR"
	HeaderEarlyData                       = "Early-Data"
	HeaderSaveData                        = "Save-Data"
	HeaderViewportWidth                   = "Viewport-Width"
	HeaderWidth                           = "Width"
	HeaderETag                            = "ETag"
	HeaderIfMatch                         = "If-Match"
	HeaderIfModifiedSince                 = "If-Modified-Since"
	HeaderIfNoneMatch                     = "If-None-Match"
	HeaderIfUnmodifiedSince               = "If-Unmodified-Since"
	HeaderLastModified                    = "Last-Modified"
	HeaderVary                            = "Vary"
	HeaderConnection                      = "Connection"
	HeaderKeepAlive                       = "Keep-Alive"
	HeaderAccept                          = "Accept"
	HeaderAcceptCharset                   = "Accept-Charset"
	HeaderAcceptEncoding                  = "Accept-Encoding"
	HeaderAcceptLanguage                  = "Accept-Language"
	HeaderCookie                          = "Cookie"
	HeaderExpect                          = "Expect"
	HeaderMaxForwards                     = "Max-Forwards"
	HeaderSetCookie                       = "Set-Cookie"
	HeaderAccessControlAllowCredentials   = "Access-Control-Allow-Credentials"
	HeaderAccessControlAllowHeaders       = "Access-Control-Allow-Headers"
	HeaderAccessControlAllowMethods       = "Access-Control-Allow-Methods"
	HeaderAccessControlAllowOrigin        = "Access-Control-Allow-Origin"
	HeaderAccessControlExposeHeaders      = "Access-Control-Expose-Headers"
	HeaderAccessControlMaxAge             = "Access-Control-Max-Age"
	HeaderAccessControlRequestHeaders     = "Access-Control-Request-Headers"
	HeaderAccessControlRequestMethod      = "Access-Control-Request-Method"
	HeaderOrigin                          = "Origin"
	HeaderTimingAllowOrigin               = "Timing-Allow-Origin"
	HeaderXPermittedCrossDomainPolicies   = "X-Permitted-Cross-Domain-Policies"
	HeaderDNT                             = "DNT"
	HeaderTk                              = "Tk"
	HeaderContentDisposition              = "Content-Disposition"
	HeaderContentEncoding                 = "Content-Encoding"
	HeaderContentLanguage                 = "Content-Language"
	HeaderContentLength                   = "Content-Length"
	HeaderContentLocation                 = "Content-Location"
	HeaderContentType                     = "Content-Type"
	HeaderForwarded                       = "Forwarded"
	HeaderVia                             = "Via"
	HeaderXForwardedFor                   = "X-Forwarded-For"
	HeaderXForwardedHost                  = "X-Forwarded-Host"
	HeaderXForwardedProto                 = "X-Forwarded-Proto"
	HeaderXForwardedProtocol              = "X-Forwarded-Protocol"
	HeaderXForwardedScheme                = "X-Forwarded-Scheme"
	HeaderXForwardedSsl                   = "X-Forwarded-Ssl"
	HeaderXUrlScheme                      = "X-Url-Scheme"
	HeaderLocation                        = "Location"
	HeaderFrom                            = "From"
	HeaderHost                            = "Host"
	HeaderReferer                         = "Referer"
	HeaderReferrerPolicy                  = "Referrer-Policy"
	HeaderUserAgent                       = "User-Agent"
	HeaderAllow                           = "Allow"
	HeaderServer                          = "Server"
	HeaderAcceptRanges                    = "Accept-Ranges"
	HeaderContentRange                    = "Content-Range"
	HeaderIfRange                         = "If-Range"
	HeaderRange                           = "Range"
	HeaderContentSecurityPolicy           = "Content-Security-Policy"
	HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
	HeaderCrossOriginResourcePolicy       = "Cross-Origin-Resource-Policy"
	HeaderExpectCT                        = "Expect-CT"
	HeaderPermissionsPolicy               = "Permissions-Policy"
	HeaderPublicKeyPins                   = "Public-Key-Pins"
	HeaderPublicKeyPinsReportOnly         = "Public-Key-Pins-Report-Only"
	HeaderStrictTransportSecurity         = "Strict-Transport-Security"
	HeaderUpgradeInsecureRequests         = "Upgrade-Insecure-Requests"
	HeaderXContentTypeOptions             = "X-Content-Type-Options"
	HeaderXDownloadOptions                = "X-Download-Options"
	HeaderXFrameOptions                   = "X-Frame-Options"
	HeaderXPoweredBy                      = "X-Powered-By"
	HeaderXXSSProtection                  = "X-XSS-Protection"
	HeaderLastEventID                     = "Last-Event-ID"
	HeaderNEL                             = "NEL"
	HeaderPingFrom                        = "Ping-From"
	HeaderPingTo                          = "Ping-To"
	HeaderReportTo                        = "Report-To"
	HeaderTE                              = "TE"
	HeaderTrailer                         = "Trailer"
	HeaderTransferEncoding                = "Transfer-Encoding"
	HeaderSecWebSocketAccept              = "Sec-WebSocket-Accept"
	HeaderSecWebSocketExtensions          = "Sec-WebSocket-Extensions"
	HeaderSecWebSocketKey                 = "Sec-WebSocket-Key"
	HeaderSecWebSocketProtocol            = "Sec-WebSocket-Protocol"
	HeaderSecWebSocketVersion             = "Sec-WebSocket-Version"
	HeaderAcceptPatch                     = "Accept-Patch"
	HeaderAcceptPushPolicy                = "Accept-Push-Policy"
	HeaderAcceptSignature                 = "Accept-Signature"
	HeaderAltSvc                          = "Alt-Svc"
	HeaderDate                            = "Date"
	HeaderIndex                           = "Index"
	HeaderLargeAllocation                 = "Large-Allocation"
	HeaderLink                            = "Link"
	HeaderPushPolicy                      = "Push-Policy"
	HeaderRetryAfter                      = "Retry-After"
	HeaderServerTiming                    = "Server-Timing"
	HeaderSignature                       = "Signature"
	HeaderSignedHeaders                   = "Signed-Headers"
	HeaderSourceMap                       = "SourceMap"
	HeaderUpgrade                         = "Upgrade"
	HeaderXDNSPrefetchControl             = "X-DNS-Prefetch-Control"
	HeaderXPingback                       = "X-Pingback"
	HeaderXRequestID                      = "X-Request-ID"
	HeaderXRequestedWith                  = "X-Requested-With"
	HeaderXRobotsTag                      = "X-Robots-Tag"
	HeaderXUACompatible                   = "X-UA-Compatible"
	HeaderXRealIP                         = "X-Real-IP"
	HeaderXAccelBuffering                 = "X-Accel-Buffering"
)

HTTP Headers were copied from net/http.

Variables

View Source
var (
	DefaultNotFoundHandler = func(c Ctx) error {
		return NewErrNotFound(nil)
	}

	DefaultMethodNotAllowed = func(Ctx) error {
		return NewErrMethodNotAllowed(nil)
	}

	DefaultOptionsHandler = func(c Ctx) error {
		return c.NoContent()
	}

	DefaultErrorHandler = func(c Ctx, err *Error) error {
		switch c.NegotiateFormat(MIMETextPlain, MIMETextHTML, MIMEApplicationJSON) {
		case MIMEApplicationJSON:
			return c.JSON(err.Code, err)
		default:
			if c.Debug() {
				return c.String(err.Code, "code=%d, message=%v, data=%v, developer_message=%s", err.Code, err.Message, err.Data, err.Developer)
			}
			return c.String(err.Code, "code=%d, message=%v, data=%v", err.Code, err.Message, err.Data)
		}
	}

	DefaultErrorTransform = func(err error) *Error {
		var e *Error
		if !errors.As(err, &e) {
			e = NewError(http.StatusInternalServerError, err)
		}
		return e
	}
)
View Source
var ErrStreamClosed = errors.New("http: Stream closed")

Functions

func Bind

func Bind(destination any, data map[string][]string, tag string) error

func ContextWithParams

func ContextWithParams(ctx context.Context, params PathParams) context.Context

func HandleUI

func HandleUI(h http.Handler) http.Handler

func UIFileServer

func UIFileServer(fs http.FileSystem) http.Handler

Types

type AfterServe

type AfterServe func(c Ctx, start, end time.Time, err error)

type Create

type Create interface {
	Create(Ctx) error
}

type Ctx

type Ctx interface {
	CtxRender
	CtxBinding
	Debug() bool
	Store() map[string]any
	Set(key string, value any)
	Get(key string) any
	Req() *Request
	SetReq(r *Request)
	Res() Response
	SetRes(r Response)
	Reset(r *http.Request, w http.ResponseWriter)
	NegotiateFormat(offered ...string) string
}

func NewCtx

func NewCtx(wool *Wool, r *http.Request, w http.ResponseWriter) Ctx

type CtxBinding

type CtxBinding interface {
	BindBody(i any) error
	BindJSON(i any) error
	BindForm(i any) error
	BindPath(i any) error
	BindQuery(i any) error
	BindHeaders(i any) error
	BindCtx(i any) error
	Bind(i any) error
	Validate(i any) error
}

type CtxRender

type CtxRender interface {
	Status(status int) error
	Render(status int, r render.Render) error
	Blob(status int, contentType string, data []byte) error
	JSON(status int, obj any) error
	IndentedJSON(status int, obj any) error
	HTML(status int, name string, obj any) error
	String(status int, format string, data ...any) error
	SSEvent(event string, data any) error
	Stream(step func(w io.Writer) error) error
	Redirect(code int, location string) error
	Created(location string) error
	NoContent() error
	OK() error
}

type DefaultCtx

type DefaultCtx struct {
	// contains filtered or unexported fields
}

func (*DefaultCtx) Bind

func (c *DefaultCtx) Bind(i any) (err error)

func (*DefaultCtx) BindBody

func (c *DefaultCtx) BindBody(i any) error

func (*DefaultCtx) BindCtx

func (c *DefaultCtx) BindCtx(i any) error

func (*DefaultCtx) BindForm

func (c *DefaultCtx) BindForm(i any) (err error)

func (*DefaultCtx) BindHeaders

func (c *DefaultCtx) BindHeaders(i any) (err error)

func (*DefaultCtx) BindJSON

func (c *DefaultCtx) BindJSON(i any) error

func (*DefaultCtx) BindPath

func (c *DefaultCtx) BindPath(i any) (err error)

func (*DefaultCtx) BindQuery

func (c *DefaultCtx) BindQuery(i any) (err error)

func (*DefaultCtx) Blob

func (c *DefaultCtx) Blob(status int, contentType string, data []byte) error

func (*DefaultCtx) Created

func (c *DefaultCtx) Created(location string) error

func (*DefaultCtx) Debug

func (c *DefaultCtx) Debug() bool

func (*DefaultCtx) Get

func (c *DefaultCtx) Get(key string) any

func (*DefaultCtx) HTML

func (c *DefaultCtx) HTML(status int, name string, obj any) error

func (*DefaultCtx) IndentedJSON

func (c *DefaultCtx) IndentedJSON(status int, obj any) error

func (*DefaultCtx) JSON

func (c *DefaultCtx) JSON(status int, obj any) error

func (*DefaultCtx) NegotiateFormat

func (c *DefaultCtx) NegotiateFormat(offered ...string) string

func (*DefaultCtx) NoContent

func (c *DefaultCtx) NoContent() error

func (*DefaultCtx) OK

func (c *DefaultCtx) OK() error

func (*DefaultCtx) Redirect

func (c *DefaultCtx) Redirect(code int, location string) error

func (*DefaultCtx) Render

func (c *DefaultCtx) Render(status int, r render.Render) error

func (*DefaultCtx) Req

func (c *DefaultCtx) Req() *Request

func (*DefaultCtx) Res

func (c *DefaultCtx) Res() Response

func (*DefaultCtx) Reset

func (c *DefaultCtx) Reset(r *http.Request, w http.ResponseWriter)

func (*DefaultCtx) SSEvent

func (c *DefaultCtx) SSEvent(event string, data any) error

func (*DefaultCtx) Set

func (c *DefaultCtx) Set(key string, value any)

func (*DefaultCtx) SetReq

func (c *DefaultCtx) SetReq(req *Request)

func (*DefaultCtx) SetRes

func (c *DefaultCtx) SetRes(res Response)

func (*DefaultCtx) Status

func (c *DefaultCtx) Status(status int) error

func (*DefaultCtx) Store

func (c *DefaultCtx) Store() map[string]any

func (*DefaultCtx) Stream

func (c *DefaultCtx) Stream(step func(w io.Writer) error) error

func (*DefaultCtx) String

func (c *DefaultCtx) String(status int, format string, data ...any) error

func (*DefaultCtx) Validate

func (c *DefaultCtx) Validate(i any) error

type Delete

type Delete interface {
	Delete(Ctx) error
}

type Error

type Error struct {
	Code      int    `json:"code,omitempty"`
	Message   string `json:"message,omitempty"`
	Data      any    `json:"data,omitempty"`
	Developer string `json:"developer_message,omitempty"`
	Internal  error  `json:"-"`
}

func NewErrBadRequest

func NewErrBadRequest(err error, message ...string) *Error

func NewErrConflict

func NewErrConflict(err error, message ...string) *Error

func NewErrForbidden

func NewErrForbidden(err error, message ...string) *Error

func NewErrInternalServerError

func NewErrInternalServerError(err error, message ...string) *Error

func NewErrMethodNotAllowed

func NewErrMethodNotAllowed(err error, message ...string) *Error

func NewErrNotFound

func NewErrNotFound(err error, message ...string) *Error

func NewErrRequestEntityTooLarge

func NewErrRequestEntityTooLarge(err error, message ...string) *Error

func NewErrUnauthorized

func NewErrUnauthorized(err error, message ...string) *Error

func NewErrUnprocessableEntity

func NewErrUnprocessableEntity(err error, data any, message ...string) *Error

func NewError

func NewError(code int, err error, message ...string) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorHandler

type ErrorHandler func(c Ctx, err *Error) error

type ErrorTransform

type ErrorTransform func(err error) *Error

type FailedField

type FailedField struct {
	Namespace string `json:"namespace,omitempty"`
	Field     string `json:"field,omitempty"`
	Tag       string `json:"tag,omitempty"`
	Value     string `json:"value,omitempty"`
	Message   string `json:"message,omitempty"`
}

type Handler

type Handler func(c Ctx) error

func ToHandler

func ToHandler(handler http.Handler) Handler

type List

type List interface {
	List(Ctx) error
}

type Map

type Map map[string]any

type Middleware

type Middleware func(next Handler) Handler

func ToMiddleware

func ToMiddleware(wrapper func(http.Handler) http.Handler) Middleware

type Option

type Option func(*Wool)

func WithAfterServe

func WithAfterServe(as AfterServe) Option

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) Option

func WithErrorTransform

func WithErrorTransform(et ErrorTransform) Option

func WithHTMLRender

func WithHTMLRender(r render.HTMLRender) Option

func WithMethodNotAllowed

func WithMethodNotAllowed(h Handler) Option

func WithMiddleware

func WithMiddleware(mw ...Middleware) Option

func WithNewCtxFunc

func WithNewCtxFunc(newCtxFunc func(*Wool, *http.Request, http.ResponseWriter) Ctx) Option

func WithNotFoundHandler

func WithNotFoundHandler(h Handler) Option

func WithOptionsHandler

func WithOptionsHandler(h Handler) Option

func WithValidator

func WithValidator(v Validator) Option

type PartiallyUpdate

type PartiallyUpdate interface {
	PartiallyUpdate(Ctx) error
}

type PathParams

type PathParams map[string][]string

func ParamsFromContext

func ParamsFromContext(ctx context.Context) PathParams

type Request

type Request struct {
	*http.Request
	// contains filtered or unexported fields
}

func (*Request) Accept

func (r *Request) Accept() []string

func (*Request) Clone

func (r *Request) Clone(ctx context.Context) *Request

func (*Request) ContentType

func (r *Request) ContentType() string

func (*Request) FormValues

func (r *Request) FormValues() (url.Values, error)

func (*Request) IsForm

func (r *Request) IsForm() bool

func (*Request) IsJSON

func (r *Request) IsJSON() bool

func (*Request) IsMultipartForm

func (r *Request) IsMultipartForm() bool

func (*Request) IsTLS

func (r *Request) IsTLS() bool

func (*Request) PathParam

func (r *Request) PathParam(param string) string

func (*Request) PathParamID

func (r *Request) PathParamID() string

func (*Request) PathParams

func (r *Request) PathParams() PathParams

func (*Request) QueryParam

func (r *Request) QueryParam(name string) string

func (*Request) QueryParams

func (r *Request) QueryParams() url.Values

func (*Request) WithContext

func (r *Request) WithContext(ctx context.Context) *Request

type Response

type Response interface {
	http.ResponseWriter
	http.Hijacker
	http.Flusher
	Pusher() http.Pusher
	Status() int
	Size() int64
	Written() bool
	WriteString(s string) (int, error)
	WriteHeaderNow()
}

func NewResponse

func NewResponse(w http.ResponseWriter, logger *slog.Logger) Response

type Server

type Server struct {
	sync.Mutex

	Log             *slog.Logger
	CertFilesystem  fs.FS
	TLSConfig       func(tlsConfig *tls.Config)
	ListenerAddr    func(addr net.Addr)
	BeforeServe     func(s *http.Server) error
	OnShutdownError func(err error)
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg *ServerConfig, logger *slog.Logger) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) GracefulShutdown

func (s *Server) GracefulShutdown(ctx context.Context) error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start(handler http.Handler) error

func (*Server) StartC

func (s *Server) StartC(ctx context.Context, handler http.Handler) error

type ServerConfig

type ServerConfig struct {
	DisableHTTP2      bool          `mapstructure:"disable_http2"`
	HidePort          bool          `mapstructure:"hide_port"`
	CertPath          string        `mapstructure:"cert_path"`
	CertFile          string        `mapstructure:"cert_file"`
	KeyFile           string        `mapstructure:"key_file"`
	Address           string        `mapstructure:"address"`
	Network           string        `mapstructure:"network"`
	MaxHeaderBytes    int           `mapstructure:"max_header_bytes"`
	ReadHeaderTimeout time.Duration `mapstructure:"read_header_timeout"`
	ReadTimeout       time.Duration `mapstructure:"read_timeout"`
	WriteTimeout      time.Duration `mapstructure:"write_timeout"`
	IdleTimeout       time.Duration `mapstructure:"idle_timeout"`
	GracefulTimeout   time.Duration `mapstructure:"graceful_timeout"`
}

func (*ServerConfig) Init

func (cfg *ServerConfig) Init()

func (*ServerConfig) Server

func (cfg *ServerConfig) Server(handler http.Handler) *http.Server

type Take

type Take interface {
	Take(Ctx) error
}

type UIAssetWrapper

type UIAssetWrapper struct {
	FileSystem http.FileSystem
}

func (*UIAssetWrapper) Open

func (fsw *UIAssetWrapper) Open(name string) (http.File, error)

type Update

type Update interface {
	Update(Ctx) error
}

type Validator

type Validator interface {
	Validate(i any) error
	ValidateCtx(ctx context.Context, i any) error
}

func NewValidator

func NewValidator() Validator

type Wool

type Wool struct {
	Log              *slog.Logger
	NewCtxFunc       func(wool *Wool, r *http.Request, w http.ResponseWriter) Ctx
	HTMLRender       render.HTMLRender
	NotFoundHandler  Handler
	MethodNotAllowed Handler
	OptionsHandler   Handler
	ErrorHandler     ErrorHandler
	ErrorTransform   ErrorTransform
	AfterServe       AfterServe
	Validator        Validator
	// contains filtered or unexported fields
}

func New

func New(logger *slog.Logger, options ...Option) *Wool

func (*Wool) AcquireCtx

func (wool *Wool) AcquireCtx() Ctx

func (*Wool) Add

func (wool *Wool) Add(pattern string, handler Handler, methods ...string)

func (*Wool) CONNECT

func (wool *Wool) CONNECT(pattern string, handler Handler)

func (*Wool) CRUD

func (wool *Wool) CRUD(pattern string, resource any, mw ...Middleware)

func (*Wool) DELETE

func (wool *Wool) DELETE(pattern string, handler Handler)

func (*Wool) Debug

func (wool *Wool) Debug(ctx context.Context) bool

func (*Wool) Error

func (wool *Wool) Error(next Handler) Handler

func (*Wool) GET

func (wool *Wool) GET(pattern string, handler Handler)

func (*Wool) Group

func (wool *Wool) Group(pattern string, fn func(*Wool))

func (*Wool) HEAD

func (wool *Wool) HEAD(pattern string, handler Handler)

func (*Wool) MountHealth

func (wool *Wool) MountHealth()

func (*Wool) NewCtx

func (wool *Wool) NewCtx(r *http.Request, w http.ResponseWriter) Ctx

func (*Wool) OPTIONS

func (wool *Wool) OPTIONS(pattern string, handler Handler)

func (*Wool) PATCH

func (wool *Wool) PATCH(pattern string, handler Handler)

func (*Wool) POST

func (wool *Wool) POST(pattern string, handler Handler)

func (*Wool) PUT

func (wool *Wool) PUT(pattern string, handler Handler)

func (*Wool) Recover

func (wool *Wool) Recover(next Handler) Handler

func (*Wool) ReleaseCtx

func (wool *Wool) ReleaseCtx(c Ctx)

func (*Wool) ServeHTTP

func (wool *Wool) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Wool) TRACE

func (wool *Wool) TRACE(pattern string, handler Handler)

func (*Wool) UI

func (wool *Wool) UI(pattern string, fs http.FileSystem, methods ...string)

func (*Wool) Use

func (wool *Wool) Use(mw ...Middleware)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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