mirror of
https://github.com/trafficlunar/api.git
synced 2026-06-27 22:24:08 +00:00
feat: add httprate
This commit is contained in:
parent
4fd340bf22
commit
488b15083d
3 changed files with 8 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
"github.com/go-chi/httprate"
|
||||
|
||||
"backend/internal/handler"
|
||||
)
|
||||
|
|
@ -21,6 +22,7 @@ func NewRouter() {
|
|||
r.Use(middleware.Logger)
|
||||
r.Use(middleware.Recoverer)
|
||||
r.Use(middleware.Timeout(60 * time.Second))
|
||||
r.Use(httprate.LimitByRealIP(32, time.Minute))
|
||||
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "https://axolotlmaid.com", http.StatusPermanentRedirect)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue