Package Usage: go: github.com/fasthttp/router
Package router is a trie based high performance HTTP request router.
A trivial example is:
The router matches incoming requests by the request method and the path.
If a handler is registered for this path and method, the router delegates the
request to that function.
For the methods GET, POST, PUT, PATCH, DELETE and OPTIONS shortcut functions exist to
register handles, for all other methods router.Handle can be used.
The registered path, against which the router matches incoming requests, can
contain two types of parameters:
Named parameters are dynamic path segments. They match anything until the
next '/' or the path end:
Catch-all parameters match anything until the path end, including the
directory index (the '/' before the catch-all). Since they match anything
until the end, catch-all parameters must always be the final path element.
The value of parameters is saved in ctx.UserValue(<key>), consisting
each of a key and a value. The slice is passed to the Handle func as a third
parameter.
To retrieve the value of a parameter,gets by the name of the parameter
78 versions
Latest release: plus d'un an ago
576 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/fasthttp/router