Documentation ¶
Index ¶
- Variables
- func DecorateRoutes(routes *RouteCollection)
- func Fallback(controller inter.Controller) inter.RouteCollection
- func NewRoute(url string, method string, controller inter.Controller) inter.Route
- func View(uri string, view inter.View) inter.RouteCollection
- type Route
- func (r Route) Constraint() map[string]string
- func (r Route) Controller() inter.Controller
- func (r Route) Domain() string
- func (r Route) Method() string
- func (r Route) Middleware() []inter.HttpMiddleware
- func (r Route) Name() string
- func (r Route) Named(patterns ...string) bool
- func (r Route) RouteOptions() inter.RouteOptions
- func (r *Route) SetConstraint(parameter string, regex string) inter.Route
- func (r *Route) SetDestination(destination string) inter.Route
- func (r *Route) SetDomain(domain string) inter.Route
- func (r *Route) SetExcludeMiddleware(middlewares []inter.HttpMiddleware) inter.Route
- func (r *Route) SetMiddleware(middlewaresToStore []inter.HttpMiddleware) inter.Route
- func (r *Route) SetName(name string) inter.Route
- func (r *Route) SetPrefix(prefix string) inter.Route
- func (r *Route) SetStatus(status int) inter.Route
- func (r *Route) SetUri(uri string) inter.Route
- func (r Route) Uri() string
- type RouteCollection
- func Any(uri string, controller inter.Controller) *RouteCollection
- func Delete(uri string, controller inter.Controller) *RouteCollection
- func Get(uri string, controller inter.Controller) *RouteCollection
- func Group(routeCollections ...inter.RouteCollection) *RouteCollection
- func Match(methods []string, uri string, controller inter.Controller) *RouteCollection
- func NewRouteCollection(routeCollections ...inter.RouteCollection) *RouteCollection
- func Options(uri string, controller inter.Controller) *RouteCollection
- func Patch(uri string, controller inter.Controller) *RouteCollection
- func Post(uri string, controller inter.Controller) *RouteCollection
- func Put(uri string, controller inter.Controller) *RouteCollection
- func Redirect(uri string, destination string, status int) *RouteCollection
- func RedirectPermanent(uri string, destination string) *RouteCollection
- func RedirectTemporary(uri string, destination string) *RouteCollection
- func (c RouteCollection) All() []inter.Route
- func (c *RouteCollection) Domain(domain string) inter.RouteCollection
- func (c RouteCollection) Match(request inter.Request) inter.Route
- func (c *RouteCollection) Merge(routeCollection inter.RouteCollection) inter.RouteCollection
- func (c *RouteCollection) Middleware(middleware ...inter.HttpMiddleware) inter.RouteCollection
- func (c *RouteCollection) Name(name string) inter.RouteCollection
- func (c *RouteCollection) Prefix(prefix string) inter.RouteCollection
- func (c *RouteCollection) Push(route inter.Route) inter.RouteCollection
- func (c *RouteCollection) Where(parameter, regex string) inter.RouteCollection
- func (c *RouteCollection) WhereMulti(constraints map[string]string) inter.RouteCollection
- func (c *RouteCollection) WithoutMiddleware(middleware ...inter.HttpMiddleware) inter.RouteCollection
- type RouteOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var AppNotFoundError = errors.WithLevel(errors.WithStatus(errors.Wrap(RouteError, "inter.App not found in RouteCollection"), net.StatusInternalServerError), log_level.CRITICAL)
View Source
var MethodNotAllowedError = errors.WithStatus(errors.Wrap(RouteError, "HTTP method not allowed"), net.StatusMethodNotAllowed)
View Source
var RouteNotFoundError = errors.WithStatus(errors.Wrap(RouteError, "no match was found for the specified URL"), net.StatusNotFound)
Functions ¶
func DecorateRoutes ¶
func DecorateRoutes(routes *RouteCollection)
func Fallback ¶
func Fallback(controller inter.Controller) inter.RouteCollection
Types ¶
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func (Route) Constraint ¶
func (Route) Controller ¶
func (r Route) Controller() inter.Controller
func (Route) Middleware ¶
func (r Route) Middleware() []inter.HttpMiddleware
func (Route) RouteOptions ¶
func (r Route) RouteOptions() inter.RouteOptions
func (*Route) SetConstraint ¶
func (*Route) SetExcludeMiddleware ¶
func (r *Route) SetExcludeMiddleware(middlewares []inter.HttpMiddleware) inter.Route
func (*Route) SetMiddleware ¶
func (r *Route) SetMiddleware(middlewaresToStore []inter.HttpMiddleware) inter.Route
type RouteCollection ¶
type RouteCollection struct {
// contains filtered or unexported fields
}
func Any ¶
func Any(uri string, controller inter.Controller) *RouteCollection
Register a new route responding to all methods
func Delete ¶
func Delete(uri string, controller inter.Controller) *RouteCollection
Register new DELETE routes
func Get ¶
func Get(uri string, controller inter.Controller) *RouteCollection
Register new GET routes
func Group ¶
func Group(routeCollections ...inter.RouteCollection) *RouteCollection
func Match ¶
func Match(methods []string, uri string, controller inter.Controller) *RouteCollection
Register a new route with multiple methods
func NewRouteCollection ¶
func NewRouteCollection(routeCollections ...inter.RouteCollection) *RouteCollection
func Options ¶
func Options(uri string, controller inter.Controller) *RouteCollection
Register new OPTIONS routes
func Patch ¶
func Patch(uri string, controller inter.Controller) *RouteCollection
Register new PATCH routes
func Post ¶
func Post(uri string, controller inter.Controller) *RouteCollection
Register new POST routes
func Put ¶
func Put(uri string, controller inter.Controller) *RouteCollection
Register new PUT routes
func Redirect ¶
func Redirect(uri string, destination string, status int) *RouteCollection
Create a redirect from one URI to another.
func RedirectPermanent ¶
func RedirectPermanent(uri string, destination string) *RouteCollection
Create a permanent redirect from one URI to another.
func RedirectTemporary ¶
func RedirectTemporary(uri string, destination string) *RouteCollection
Create a temporary redirect from one URI to another.
func (RouteCollection) All ¶
func (c RouteCollection) All() []inter.Route
func (*RouteCollection) Domain ¶
func (c *RouteCollection) Domain(domain string) inter.RouteCollection
func (*RouteCollection) Merge ¶
func (c *RouteCollection) Merge(routeCollection inter.RouteCollection) inter.RouteCollection
func (*RouteCollection) Middleware ¶
func (c *RouteCollection) Middleware(middleware ...inter.HttpMiddleware) inter.RouteCollection
func (*RouteCollection) Name ¶
func (c *RouteCollection) Name(name string) inter.RouteCollection
func (*RouteCollection) Prefix ¶
func (c *RouteCollection) Prefix(prefix string) inter.RouteCollection
func (*RouteCollection) Push ¶
func (c *RouteCollection) Push(route inter.Route) inter.RouteCollection
func (*RouteCollection) Where ¶
func (c *RouteCollection) Where(parameter, regex string) inter.RouteCollection
Set a group of global where patterns on the routes.
func (*RouteCollection) WhereMulti ¶
func (c *RouteCollection) WhereMulti(constraints map[string]string) inter.RouteCollection
func (*RouteCollection) WithoutMiddleware ¶
func (c *RouteCollection) WithoutMiddleware(middleware ...inter.HttpMiddleware) inter.RouteCollection
type RouteOptions ¶
type RouteOptions struct {
// contains filtered or unexported fields
}
func (RouteOptions) Prefixes ¶
func (r RouteOptions) Prefixes() []string
func (RouteOptions) Status ¶
func (r RouteOptions) Status() int
Click to show internal directories.
Click to hide internal directories.