chore: replace gorilla/mux with go-chi/chi (#332)

BREAKING CHANGE:
The returned router from `op.CreateRouter()` is now a `chi.Router`

Closes #301
This commit is contained in:
Tim Möhlmann 2023-03-17 17:36:02 +02:00 committed by GitHub
parent 62caf5dafe
commit 57fb9f77aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 98 additions and 60 deletions

View file

@ -5,12 +5,12 @@ import (
"fmt"
"net/http"
"github.com/gorilla/mux"
"github.com/go-chi/chi"
)
type login struct {
authenticate authenticate
router *mux.Router
router chi.Router
callback func(context.Context, string) string
}
@ -24,9 +24,9 @@ func NewLogin(authenticate authenticate, callback func(context.Context, string)
}
func (l *login) createRouter() {
l.router = mux.NewRouter()
l.router.Path("/username").Methods("GET").HandlerFunc(l.loginHandler)
l.router.Path("/username").Methods("POST").HandlerFunc(l.checkLoginHandler)
l.router = chi.NewRouter()
l.router.Get("/username", l.loginHandler)
l.router.Post("/username", l.checkLoginHandler)
}
type authenticate interface {