BunRouter Middleware (BMW)
This library provides a set of useful middlewares for the BunRouter package in Go.
Installation
To install the library, run the following command:
go get github.com/atridadl/bmw
Usage
Here's an example of how to use the middlewares in this library:
package main
import (
bmw "github.com/atridadl/bmw"
"github.com/uptrace/bunrouter"
)
func main() {
router := bunrouter.New()
router.Use(bmw.RateLimit())
router.Use(bmw.RequestID())
router.Use(bmw.Secure())
// ...
}
Middlewares
RateLimit
The RateLimit middleware helps to limit the rate of incoming requests.
RequestID
The RequestID middleware assigns a unique ID to each incoming request.
Secure
The Secure middleware adds security-related headers to responses.