Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudlena/adapters
Golang HTTP middleware following the Adapter Pattern
https://github.com/cloudlena/adapters
adapter go golang http middleware
Last synced: about 2 months ago
JSON representation
Golang HTTP middleware following the Adapter Pattern
- Host: GitHub
- URL: https://github.com/cloudlena/adapters
- Owner: cloudlena
- License: other
- Created: 2017-03-11T10:56:02.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2024-10-15T18:12:24.000Z (3 months ago)
- Last Synced: 2024-10-17T02:32:08.465Z (3 months ago)
- Topics: adapter, go, golang, http, middleware
- Language: Go
- Size: 1.87 MB
- Stars: 15
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Adapters
[![Go Report Card](https://goreportcard.com/badge/github.com/cloudlena/adapters)](https://goreportcard.com/report/github.com/cloudlena/adapters)
[![Build Status](https://github.com/cloudlena/adapters/actions/workflows/main.yml/badge.svg)](https://github.com/cloudlena/adapters/actions)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/cloudlena/adapters)](https://pkg.go.dev/github.com/cloudlena/adapters)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.](https://medium.com/@matryer/writing-middleware-in-golang-and-how-go-makes-it-so-much-fun-4375c1246e81)
Adapters can be chained in many ways (e.g. with [Alice](https://github.com/justinas/alice) or [gorilla/mux](https://github.com/gorilla/mux#middleware)) because they all implement `func (http.Handler) http.Handler`.
## Contents
This package contains the following adapters:
- [Basic Auth](https://github.com/cloudlena/adapters/tree/main/basicauth): Checks for basic authentication
- [CORS](https://github.com/cloudlena/adapters/tree/main/cors): Adds the necessary CORS headers to a response
- [Enforce HTTPS](https://github.com/cloudlena/adapters/tree/main/enforcehttps): Redirects HTTP requests to HTTPS
- [Logging](https://github.com/cloudlena/adapters/tree/main/logging): Logs incoming requests and the time it took to serve them
- [OAuth 2](https://github.com/cloudlena/adapters/tree/main/oauth2): Checks for OAuth 2 authentication and issues sessions using JWTs