A flexible, powerful, high performance and minimalist Go Web HTTP router framework.
Context
, Router
, Route
, RouteBuilder
etc.Ship
as an independent component to run a standard http.Handler
.Ship
as an independent stardard http.Handler
.GoDoc
.Logger
middleware supports the customized log function.GZip
middleware supports the prefix or suffix domain, such as www.example.*
and *.example.com
.Logger
middleware releases the buffer into the pool after the request ends. As a result, it can be reused by the next request.IsInteger
to report whether the string is an integer.SetStructFieldToDefault
supports the types time.Time
, time.Duration
and the pointer to these types.HandleError
to handle the error.InStrings
and SplitHostPort
.Hosts
for the type Ship
to get the list of the added hosts.HTTPPprofToRouteInfo
.RouteCtxData
from the type Context
.RealIP
from the type Context
.URLParamsMaxNum
from the type Ship
and use the field MaxURLParamNum
instead.MapType
from the type Route
, and not support to register the methods of a type as the routes.DefaultMethodMapping
and the fields MethodMapping
and MaxBodySize
of the type Ship
.JSONRenderer
, JSONPrettyRenderer
, XMLRenderer
and XMLPrettyRenderer
of the interface Renderer
.NewRouterWithConfig
and use NewRouter
instead.RemoveTrailingSlash
from the sub-package echo
.general
, that's the implementation of the general router.TokenFunc
and TokenValidator
from the sub-package middleware
.ErrTokenFromHeader
, ErrTokenFromQuery
and ErrTokenFromForm
from the sub-package middleware
.CSRF
, RemoveTrailingSlash
, ReqBodyLogger
, CleanPath
, TokenAuth
from the sub-package middleware
.FromFunc
, IsNoTokenError
, GetTokenFromHeader
, GetTokenFromQuery
and GetTokenFromForm
from the sub-package middleware
.Gzip
.XxxJSON
and use Request
instead of RequestJSONWithContext
, RequestJSONWithContextAndHeaders
.CtxDataSize
, MaxURLParamNum
, RouteExecutor
of the type Ship
to CtxDataInitCap
, URLParamMaxNum
, RouterExecutor
URL
of the type Context
to URLPath
.Each
to Range
of the interface RegexpHostRouter
.AddContentTypeToSlice
to AddContentTypeMapping
.BodyLimit
to BodyLenLimit
.MaxRequests
only supports one paramenter, that's the maximum number of the requests.CORS
and Logger
use the pointer to the config instead of the rest parameter.RequestID
use the explicit function as the parameter instead of the rest parameter.RWLocker
instead of *sync.RWMutex
as the field Lock
of the type Ship
.MethodNotAllowedHandler
supports the allowed methods as the parameter.FindRoute
of the type Context
no longer returns RouteInfo
, but only the bool ok
.Session
and the function NewMemorySession
from the sub-package session
to the root package.Binder
and some implementation, such as JSONBinder
, XMLBinder
, FormBinder
and QueryBinder
, from the sub-package binder
to the root package.herror
and move the errors and types into the root package.render
and move the interface Renderer
, the type MuxRenderer
and the function RendererFunc
into the root package.Handler
as the handler.Ship.SetDefaultRouter
allows that the router parameter is nil
to lookup the router by the host.Config
to configure the echo
router in order to add the new features without breaking compatibility.echo.Router.Del()
supports the RemoveTrailingSlash
general
and echo
router supports the type func(allowedMethods []string) interface{}
to returns the handler with the allowed methods.ClientIP()
for Context
instead of the method RealIP()
.SetDefaultRouter
and GetDefaultRouter
for Ship
to reset the default host router.MaxBodySize
for Ship
to support the maximum size of the body of all the requests.SetStructFieldToDefault
supports the unexported fieldsRegexpHostRouter
to allow the user to customize the virtual host based on the regular expression.RouteExecutor
for Ship
to customize the route matching after matching the host and before finding the route.Ship.AddHost(host string, router router.Router)
supports the second parameter router
to be nil
.Context.RouteInfo.Host
to the virtual host after matching the host router, so you can use it at any time to check which virtual host router is handling the request.