Skip to content

Golang HTTP middleware following the Adapter Pattern

License

Notifications You must be signed in to change notification settings

cloudlena/adapters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adapters

Go Report Card Build Status PkgGoDev

Adapters is a collection of useful HTTP middleware or "Adapters". They follow the Adapter Pattern described by Mat Ryer in his blog post Writing middleware in #golang and how Go makes it so much fun.

Adapters can be chained in many ways (e.g. with Alice or gorilla/mux) because they all implement func (http.Handler) http.Handler.

Contents

This package contains the following adapters:

  • Basic Auth: Checks for basic authentication
  • CORS: Adds the necessary CORS headers to a response
  • Enforce HTTPS: Redirects HTTP requests to HTTPS
  • Logging: Logs incoming requests and the time it took to serve them
  • OAuth 2: Checks for OAuth 2 authentication and issues sessions using JWTs

About

Golang HTTP middleware following the Adapter Pattern

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published