feat: add httprate

This commit is contained in:
axolotlmaid 2024-09-25 21:30:44 +01:00
parent 4fd340bf22
commit 488b15083d
3 changed files with 8 additions and 0 deletions

View file

@ -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)