muxchain - Lightweight Middleware for net/http

  •        9

MuxChain is a small package designed to complement net/http for specifying chains of handlers. With it, you can succinctly compose layers of middleware without introducing large dependencies or effectively defeating the type system.This specifies that all patterns matched should be handled by the logger, then gzip, then echo. Since we're chaining to the default MuxChain, we can just pass that to http.ListenAndServe. You can see a more complete example in the "sample" directory.

https://github.com/stephens2424/muxchain

Tags
Implementation
License
Platform

   




Related Projects

Negroni - Idiomatic HTTP Middleware for Golang

  •    Go

Negroni is an idiomatic approach to web middleware in Go. It is tiny, non-intrusive, and encourages use of net/http Handlers. If you like the idea of Martini, but you think it contains too much magic, then Negroni is a great fit. Negroni is not a framework. It is a middleware-focused library that is designed to work directly with net/http.

interpose - Minimalist net/http middleware for golang

  •    Go

Interpose is a minimalist net/http middleware framework for golang. It uses http.Handler as its core unit of functionality, minimizing complexity and maximizing inter-operability with other middleware frameworks.All that it does is manage middleware. It comes with nothing baked in. You bring your own router, etc. See below for some well-baked examples.

alice - Painless middleware chaining for Go

  •    Go

Alice provides a convenient way to chain your HTTP middleware functions and the app handler.None of the other middleware chaining solutions behaves exactly like Alice. Alice is as minimal as it gets: in essence, it's just a for loop that does the wrapping for you.

secure - HTTP middleware for Go that facilitates some quick security wins.

  •    Go

Secure is an HTTP middleware for Go that facilitates some quick security wins. It's a standard net/http Handler, and can be used with many frameworks or directly with Go's net/http package.Be sure to include the Secure middleware as close to the top (beginning) as possible (but after logging and recovery). It's best to do the allowed hosts and SSL check before anything else.

chi - Lightweight, idiomatic and composable router for building Go HTTP services

  •    Go

chi is a lightweight, idiomatic and composable router for building Go 1.7+ HTTP services. It's especially good at helping you write large REST API services that are kept maintainable as your project grows and changes. chi is built on the new context package introduced in Go 1.7 to handle signaling, cancelation and request-scoped values across a handler chain.


web - Go Router + Middleware. Your Contexts.

  •    Go

gocraft/web is a Go mux and middleware package. We deal with casting and reflection so YOUR code can be statically typed. And we're fast.Performance is a first class concern. Every update to this package has its performance measured and tracked in BENCHMARK_RESULTS.

goji - Goji is a minimalistic and flexible HTTP request multiplexer for Go (golang)

  •    Go

Goji is a HTTP request multiplexer, similar to net/http.ServeMux. It compares incoming requests to a list of registered Patterns, and dispatches to the http.Handler that corresponds to the first matching Pattern. Goji also supports Middleware (composable shared functionality applied to every request) and uses the standard context package to store request-scoped values.Please refer to Goji's GoDoc Documentation for a full API reference.

Gin - HTTP web framework written in Go (Golang)

  •    Go

Gin is a web framework written in Go (Golang). It features a martini-like API with much better performance, up to 40 times faster thanks to httprouter. If you need performance and good productivity, you will love You can add global, per-group, and per-route middlewares, thousands of nested groups, nice JSON validation and rendering. And the performance will be still great. Gin uses httprouter internally, the fastest HTTP router for Golang. Httprouter was created by Julien Schmidt and it’s based in a Radix Tree algorithm.

tollbooth - Simple middleware to rate-limit HTTP requests.

  •    Go

This is a generic middleware to rate-limit HTTP requests.NOTE 1: This library is considered finished.

gentleman - Full-featured, plugin-oriented, composable HTTP client toolkit for Go

  •    Go

Full-featured, plugin-driven, middleware-oriented toolkit to easily create rich, versatile and composable HTTP clients in Go.gentleman embraces extensibility and composition principles in order to provide a flexible way to easily create featured HTTP client layers based on built-in or third-party plugins that you can register and reuse across HTTP clients.

go-jwt-middleware - A Middleware for Go Programming Language to check for JWTs on HTTP requests

  •    Go

A middleware that will check that a JWT is sent on the Authorization header and will then set the content of the JWT into the user variable of the request.This module lets you authenticate HTTP requests using JWT tokens in your Go Programming Language applications. JWTs are typically used to protect API endpoints, and are often issued using OpenID Connect.

nosurf - CSRF protection middleware for Go.

  •    Go

nosurf is an HTTP package for Go that helps you prevent Cross-Site Request Forgery attacks. It acts like a middleware and therefore is compatible with basically any Go HTTP application.Even though CSRF is a prominent vulnerability, Go's web-related package infrastructure mostly consists of micro-frameworks that neither do implement CSRF checks, nor should they.

siesta - Composable framework for writing HTTP handlers in Go.

  •    Go

Siesta is a framework for writing composable HTTP handlers in Go. It supports typed URL parameters, middleware chains, and context passing.Siesta offers a Service type, which is a collection of middleware chains and handlers rooted at a base URI. There is no distinction between a middleware function and a handler function; they are all considered to be handlers and have access to the same arguments.

gziphandler - Golang middleware to gzip HTTP responses

  •    Go

This is a tiny Go package which wraps HTTP handlers to transparently gzip the response body, for clients which support it. Although it's usually simpler to leave that to a reverse proxy (like nginx or Varnish), this package is useful when that's undesirable.The docs can be found at godoc.org, as usual.

Mainflux - Industrial IoT Messaging and Device Management Server

  •    Go

Mainflux is modern, scalable, secure open source and patent-free IoT cloud platform written in Go.It accepts user, device, and application connections over various network protocols (i.e. HTTP, MQTT, WebSocket, CoAP), thus making a seamless bridge between them. It is used as the IoT middleware for building complex IoT solutions.

tesla - The flexible HTTP client library for Elixir, with support for middleware and multiple adapters

  •    Elixir

Tesla is an HTTP client loosely based on Faraday. It embraces the concept of middleware when processing the request/response cycle. Note that this README refers to the master branch of Tesla, not the latest released version on Hex. See the documentation for the documentation of the version you're using.

go-server-timing - Go (golang) library for creating and consuming HTTP Server-Timing headers

  •    Go

Middleware for injecting the server timing struct into the request Context and writing the Server-Timing header. Concurrency-safe structures for easily recording timings of multiple concurrency tasks.

faraday-http-cache - a faraday middleware that respects HTTP cache

  •    Ruby

a Faraday middleware that respects HTTP cache, by checking expiration and validation of the stored responses. The middleware accepts a store option for the cache backend responsible for recording the API responses that should be stored. Stores should respond to write, read and delete, just like an object from the ActiveSupport::Cache API.

csrf - gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services

  •    Go

gorilla/csrf is also compatible with middleware 'helper' libraries like Alice and Negroni....and then collect the token with csrf.Token(r) in your handlers before passing it to the template, JSON body or HTTP header (see below).