Skip to content

Latest commit

 

History

History

middleware

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Built'n Handlers

Middleware Example
basic authentication ion/_examples/authentication/basicauth
localization and internationalization ion/_examples/miscellaneous/i81n
request logger ion/_examples/http_request/request-logger
profiling (pprof) ion/_examples/miscellaneous/pprof
recovery ion/_examples/miscellaneous/recover

Experimental Handlers

Most of the experimental handlers are ported to work with ion's handler form, from third-party sources.

Middleware Description Example
jwt Middleware checks for a JWT on the Authorization header on incoming requests and decodes it. get-ion/middleware/jwt/_example
cors HTTP Access Control. get-ion/middleware/cors/_example
secure Middleware that implements a few quick security wins. get-ion/middleware/secure/_example
tollbooth Generic middleware to rate-limit HTTP requests. get-ion/middleware/tollbooth/_examples/limit-handler
cloudwatch AWS cloudwatch metrics middleware. get-ion/middleware/cloudwatch/_example
new relic Official New Relic Go Agent. get-ion/middleware/newrelic/_example
prometheus Easily create metrics endpoint for the prometheus instrumentation tool get-ion/middleware/prometheus/_example

Third-Party Handlers

ion has its own middleware form of func(ctx context.Context) but it's also compatible with all net/http middleware forms. See here.

Here's a small list of useful third-party handlers:

Middleware Description
goth OAuth, OAuth2 authentication. Example
binding Data binding from HTTP requests into structs
csp Content Security Policy (CSP) support
delay Add delays/latency to endpoints. Useful when testing effects of high latency
onthefly Generate TinySVG, HTML and CSS on the fly
permissions2 Cookies, users and permissions
RestGate Secure authentication for REST API endpoints
stats Store information about your web application (response time, etc.)
VanGoH Configurable AWS-Style HMAC authentication middleware
xrequestid Middleware that assigns a random X-Request-Id header to each request
digits Middleware that handles Twitter Digits authentication

Feel free to put up your own middleware in this list!