Ecosyste.ms: Repos

An open API service providing repository metadata for many open source software ecosystems.

Package Usage: go: github.com/gorilla/mux

Package mux implements a request router and dispatcher. The name mux stands for "HTTP request multiplexer". Like the standard http.ServeMux, mux.Router matches incoming requests against a list of registered routes and calls a handler for the route that matches the URL or other conditions. The main features are: Let's start registering a couple of URL paths and handlers: Here we register three routes mapping URL paths to handlers. This is equivalent to how http.HandleFunc() works: if an incoming request URL matches one of the paths, the corresponding handler is called passing (http.ResponseWriter, *http.Request) as parameters. Paths can have variables. They are defined using the format {name} or {name:pattern}. If a regular expression pattern is not defined, the matched variable will be anything until the next slash. For example: Groups can be used inside patterns, as long as they are non-capturing (?:re). For example: The names are used to create a map of route variables which can be retrieved calling mux.Vars(): Note that if any capturing groups are present, mux will panic() during parsing. To prevent this, convert any capturing groups to non-capturing, e.g. change "/{sort:(asc|desc)}" to "/{sort:(?:asc|desc)}". This is a change from prior versions which behaved unpredictably when capturing groups were present. And this is all you need to know about the basic usage. More advanced options are explained below. Routes can also be restricted to a domain or subdomain. Just define a host pattern to be matched. They can also have variables: There are several other matchers that can be added. To match path prefixes: ...or HTTP methods: ...or URL schemes: ...or header values: ...or query values: ...or to use a custom matcher function: ...and finally, it is possible to combine several matchers in a single route: Setting the same matching conditions again and again can be boring, so we have a way to group several routes that share the same requirements. We call it "subrouting". For example, let's say we have several URLs that should only match when the host is "www.example.com". Create a route for that host and get a "subrouter" from it: Then register routes in the subrouter: The three URL paths we registered above will only be tested if the domain is "www.example.com", because the subrouter is tested first. This is not only convenient, but also optimizes request matching. You can create subrouters combining any attribute matchers accepted by a route. Subrouters can be used to create domain or path "namespaces": you define subrouters in a central place and then parts of the app can register its paths relatively to a given subrouter. There's one more thing about subroutes. When a subrouter has a path prefix, the inner routes use it as base for their paths: Note that the path provided to PathPrefix() represents a "wildcard": calling PathPrefix("/static/").Handler(...) means that the handler will be passed any request that matches "/static/*". This makes it easy to serve static files with mux: Now let's see how to build registered URLs. Routes can be named. All routes that define a name can have their URLs built, or "reversed". We define a name calling Name() on a route. For example: To build a URL, get the route and call the URL() method, passing a sequence of key/value pairs for the route variables. For the previous route, we would do: ...and the result will be a url.URL with the following path: This also works for host and query value variables: All variables defined in the route are required, and their values must conform to the corresponding patterns. These requirements guarantee that a generated URL will always match a registered route -- the only exception is for explicitly defined "build-only" routes which never match. Regex support also exists for matching Headers within a route. For example, we could do: ...and the route will match both requests with a Content-Type of `application/json` as well as `application/text` There's also a way to build only the URL host or path for a route: use the methods URLHost() or URLPath() instead. For the previous route, we would do: And if you use subrouters, host and path defined separately can be built as well: Mux supports the addition of middlewares to a Router, which are executed in the order they are added if a match is found, including its subrouters. Middlewares are (typically) small pieces of code which take one request, do something with it, and pass it down to another middleware or the final handler. Some common use cases for middleware are request logging, header manipulation, or ResponseWriter hijacking. Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc (closures can access variables from the context where they are created). A very basic middleware which logs the URI of the request being handled could be written as: Middlewares can be added to a router using `Router.Use()`: A more complex authentication middleware, which maps session token to users, could be written as: Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to.
14 versions
Latest release: 6 months ago
27,498 dependent packages

View more package details: https://packages.ecosyste.ms/registries/proxy.golang.org/packages/github.com/gorilla/mux

View more repository details: https://repos.ecosyste.ms/hosts/GitHub/repositories/gorilla%2Fmux

Dependent Repos 97,463

Team-Kujira/ibc-go Fork of cosmos/ibc-go
Interblockchain Communication Protocol (IBC) implementation in Golang.
  • v1.6.2 go.sum
  • v1.7.3 go.sum
  • v1.8.0 go.sum

Size: 30.2 MB - Last synced: 7 days ago - Pushed: 7 months ago

mdisibio/tempo Fork of grafana/tempo
Grafana Tempo is a high volume, minimal dependency trace storage.
  • v1.8.0 cmd/tempo-serverless/cloud-run/go.mod
  • v1.7.3 cmd/tempo-serverless/cloud-run/go.sum
  • v1.8.0 cmd/tempo-serverless/cloud-run/go.sum
  • v1.8.0 cmd/tempo-serverless/lambda/go.mod
  • v1.7.3 cmd/tempo-serverless/lambda/go.sum
  • v1.8.0 cmd/tempo-serverless/lambda/go.sum
  • v1.8.0 go.mod
  • v1.7.3 go.sum
  • v1.8.0 go.sum

Size: 137 MB - Last synced: about 14 hours ago - Pushed: 1 day ago

xpivarc/kubevirt Fork of kubevirt/kubevirt
Kubernetes Virtualization API and runtime in order to define and manage virtual machines.
  • v0.0.0-20191024121256-f395758b854c go.sum
  • v1.7.4 go.sum
  • v0.0.0-20191024121256-f395758b854c staging/src/kubevirt.io/client-go/go.sum
  • v1.7.4 staging/src/kubevirt.io/client-go/go.sum

Size: 262 MB - Last synced: about 2 months ago - Pushed: about 2 months ago

antonyggvzvmnxxcx/linkerd2 Fork of linkerd/linkerd2
Ultralight, security-first service mesh for Kubernetes. Main repo for Linkerd 2.x.
  • v1.8.0 go.mod
  • v1.7.3 go.sum
  • v1.8.0 go.sum

Size: 33.5 MB - Last synced: about 1 year ago - Pushed: about 1 year ago

jan--f/telemeter Fork of openshift/telemeter
Prometheus push federation
  • v1.6.2 tools/go.sum
  • v1.7.1 tools/go.sum
  • v1.7.3 tools/go.sum

Size: 35 MB - Last synced: 11 months ago - Pushed: 11 months ago

KauzClay/net-kourier Fork of knative-sandbox/net-kourier
Purpose-built Knative Ingress implementation using just Envoy with no additional CRDs
  • v1.8.0 go.sum

Size: 35.4 MB - Last synced: 11 months ago - Pushed: about 1 year ago

rfay/ddev Fork of ddev/ddev
Drud dev: a local development environment management system
  • v1.7.2 go.sum
  • v1.7.3 go.sum

Size: 110 MB - Last synced: 1 day ago - Pushed: 1 day ago

konveyor/analyzer-lsp
Add-on that is focused on providing analysis based on the Language Server Protocol.
  • v1.8.0 go.sum

Size: 9.24 MB - Last synced: 3 days ago - Pushed: 3 days ago

johnnorton/goHelloWorldServer Fork of nofarb/goHelloWorldServer
  • v1.6.2 go.mod
  • v1.6.2 go.sum

Size: 105 KB - Last synced: 7 months ago - Pushed: about 1 year ago

FranLucchini/try_seldonCore_JenkinsX
Check how to use Seldon Core with Jenkins X
  • v1.6.2 versionStream/tests/go.sum
  • v1.7.2 versionStream/tests/go.sum
  • v1.7.3 versionStream/tests/go.sum

Size: 244 KB - Last synced: about 1 year ago - Pushed: almost 2 years ago

souravdev-eng/E-com-micro-service
  • v1.8.0 cart/go.mod
  • v1.8.0 cart/go.sum

Size: 3.32 MB - Last synced: 4 months ago - Pushed: 4 months ago

carlkyrillos/integreatly-operator Fork of integr8ly/integreatly-operator
An Openshift Operator based on the Operator SDK for installing and reconciling Integreatly services
  • v1.8.0 go.mod
  • v0.0.0-20191024121256-f395758b854c go.sum
  • v1.6.2 go.sum
  • v1.7.1 go.sum
  • v1.7.2 go.sum
  • v1.7.3 go.sum
  • v1.8.0 go.sum

Size: 126 MB - Last synced: 10 days ago - Pushed: 10 days ago

rancher-max/rancher Fork of rancher/rancher
Complete container management platform
  • v1.7.3 cmd/rancherd/go.sum
  • v1.8.0 cmd/rancherd/go.sum
  • v1.8.0 go.mod
  • v1.6.2 go.sum
  • v1.7.3 go.sum
  • v1.7.4 go.sum
  • v1.8.0 go.sum

Size: 131 MB - Last synced: 17 days ago - Pushed: 17 days ago

FairwindsOps/insights-cli
A command line tool for Fairwinds Insights
  • v1.7.2 go.sum
  • v1.7.3 go.sum
  • v1.8.0 go.sum

Size: 460 KB - Last synced: 10 days ago - Pushed: 12 days ago

msrinivasssa/go-trial-app
  • v1.6.2 go.sum
  • v1.7.3 go.sum

Size: 397 KB - Last synced: about 1 year ago - Pushed: about 1 year ago

accuknox/tools
Collection of command line tools to deploy policy engines, policy discovery engines and associated components.
  • v1.7.2 container-snapshot/go.sum
  • v1.8.0 container-snapshot/go.sum

Size: 40.1 MB - Last synced: 10 months ago - Pushed: 10 months ago

ahmedbutt7121991/golang Fork of NerdCademyDev/golang
All the code for the golang series will be here
  • v1.8.0 09_web_sockets/go.mod
  • v1.8.0 09_web_sockets/go.sum

Size: 1 MB - Last synced: about 1 year ago - Pushed: almost 2 years ago

jrivera-px/operator Fork of libopenstorage/operator
Storage operator for Kubernetes
  • v1.6.2 go.sum
  • v1.7.1 go.sum
  • v1.7.3 go.sum
  • v1.8.0 go.sum

Size: 34.9 MB - Last synced: about 1 year ago - Pushed: about 1 year ago

rxrddd/austin-v2
基于kratos 的聚合消息推送平台
  • v1.8.0 go.mod

Size: 1.77 MB - Last synced: about 1 year ago - Pushed: about 1 year ago

paketo-buildpacks/go
A Cloud Native Buildpack for Go
  • v1.6.2 go.sum
  • v1.7.2 go.sum
  • v1.7.3 go.sum
  • v1.8.0 go.sum

Size: 82.5 MB - Last synced: 1 day ago - Pushed: 1 day ago

slachiewicz/kubernetes-client Fork of fabric8io/kubernetes-client
Java client for Kubernetes & OpenShift
  • v1.6.2 extensions/camel-k/generator-v1/go.sum
  • v1.7.1 extensions/camel-k/generator-v1/go.sum
  • v1.7.2 extensions/camel-k/generator-v1/go.sum
  • v1.7.3 extensions/camel-k/generator-v1/go.sum
  • v1.7.4 extensions/camel-k/generator-v1/go.sum
  • v1.6.2 extensions/camel-k/generator-v1alpha1/go.sum
  • v1.7.1 extensions/camel-k/generator-v1alpha1/go.sum
  • v1.7.2 extensions/camel-k/generator-v1alpha1/go.sum
  • v1.7.3 extensions/camel-k/generator-v1alpha1/go.sum
  • v1.7.4 extensions/camel-k/generator-v1alpha1/go.sum
  • v1.8.0 extensions/certmanager/generator-v1/go.sum
  • v1.8.0 extensions/certmanager/generator-v1alpha2/go.sum
  • v1.8.0 extensions/certmanager/generator-v1alpha3/go.sum
  • v1.8.0 extensions/certmanager/generator-v1beta1/go.sum
  • v1.7.0 extensions/chaosmesh/generator/go.sum
  • v1.6.2 extensions/knative/generator/go.sum
  • v1.7.2 extensions/knative/generator/go.sum
  • v1.7.3 extensions/knative/generator/go.sum
  • v1.7.4 extensions/knative/generator/go.sum
  • v1.6.2 extensions/tekton/generator-v1alpha1/go.sum
  • v1.7.3 extensions/tekton/generator-v1alpha1/go.sum
  • v1.6.2 extensions/tekton/generator-v1beta1/go.sum
  • v1.7.2 extensions/tekton/generator-v1beta1/go.sum
  • v1.7.3 extensions/tekton/generator-v1beta1/go.sum
  • v1.7.4 extensions/tekton/generator-v1beta1/go.sum
  • v1.8.0 kubernetes-model-generator/go.mod
  • v0.0.0-20191024121256-f395758b854c kubernetes-model-generator/go.sum
  • v1.6.2 kubernetes-model-generator/go.sum
  • v1.7.1 kubernetes-model-generator/go.sum
  • v1.7.2 kubernetes-model-generator/go.sum
  • v1.7.3 kubernetes-model-generator/go.sum
  • v1.7.4 kubernetes-model-generator/go.sum
  • v1.8.0 kubernetes-model-generator/go.sum

Size: 466 MB - Last synced: 2 days ago - Pushed: 2 days ago

paketo-buildpacks/dotnet-core
A Cloud Native Buildpack for .NET Core
  • v1.6.2 go.sum
  • v1.7.2 go.sum

Size: 134 MB - Last synced: 1 day ago - Pushed: 1 day ago