Documentation
¶
Index ¶
- type Attr
- type Middleware
- type MiddlewareFunc
- type Route
- type Router
- func (r *Router) Delete(path string, handler http.Handler) *Route
- func (r *Router) Get(path string, handler http.Handler) *Route
- func (r *Router) Group(prefix string, cb func(r *Router))
- func (r *Router) Handle(p string, handler http.Handler) *Route
- func (r *Router) Patch(path string, handler http.Handler) *Route
- func (r *Router) Paths(ctx context.Context, basePath string) (*spec.Paths, error)
- func (r *Router) Post(path string, handler http.Handler) *Route
- func (r *Router) PrintRoutes()
- func (r *Router) Put(path string, handler http.Handler) *Route
- func (r *Router) Register(ctx context.Context)
- func (r *Router) Routes() []*Route
- func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *Router) Use(middleware Middleware)
- func (r *Router) UseFunc(middleware func(http.Handler) http.Handler)
- func (r *Router) Validate(ctx context.Context) error
- type SalusaResolver
- type URLResolver
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶ added in v0.13.1
type MiddlewareFunc ¶
func (MiddlewareFunc) Middleware ¶ added in v0.13.1
func (f MiddlewareFunc) Middleware(next http.Handler) http.Handler
type Route ¶ added in v0.8.0
func (*Route) GetMiddleware ¶ added in v0.13.1
func (r *Route) GetMiddleware() []Middleware
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Example ¶
package main import ( "github.com/abibby/salusa/request" "github.com/abibby/salusa/router" ) func main() { r := router.New() r.Group("/test", func(r *router.Router) { r.Get("/", request.Handler(func(r *any) (any, error) { return nil, nil })) }) }
Output:
func (*Router) PrintRoutes ¶ added in v0.8.0
func (r *Router) PrintRoutes()
func (*Router) Use ¶
func (r *Router) Use(middleware Middleware)
type SalusaResolver ¶ added in v0.8.0
type SalusaResolver struct {
// contains filtered or unexported fields
}
func NewResolver ¶ added in v0.8.0
func NewResolver(origin string, r *Router) *SalusaResolver
func (*SalusaResolver) Resolve ¶ added in v0.8.0
func (r *SalusaResolver) Resolve(name string, params ...any) string
func (*SalusaResolver) ResolveHandler ¶ added in v0.8.0
func (r *SalusaResolver) ResolveHandler(h http.Handler, params ...any) string
Click to show internal directories.
Click to hide internal directories.