Skip to content

Commit

Permalink
update: remove chi package
Browse files Browse the repository at this point in the history
  • Loading branch information
KawaiKenta committed Jan 6, 2025
1 parent 5232fd0 commit 419e692
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module github.com/kurusugawa-computer/freee-go

go 1.21.6

require github.com/go-chi/chi/v5 v5.1.0 // indirect
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
14 changes: 9 additions & 5 deletions oauth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"net/url"
"strconv"
"strings"

"github.com/go-chi/chi/v5"
)

type opt struct {
Expand Down Expand Up @@ -111,9 +109,15 @@ func Authorize(clientID string, port int, opts ...OptFunc) (string, error) {
http.Error(w, "Not Found", http.StatusNotFound)
})

mux := chi.NewRouter()
mux.Handle("/", authHandler)
mux.Handle("/*", notFoundHandler)
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/":
authHandler.ServeHTTP(w, r)
default:
notFoundHandler.ServeHTTP(w, r)
}
})

server := &http.Server{
Addr: fmt.Sprintf(":%d", port),
Expand Down

0 comments on commit 419e692

Please sign in to comment.