Add logger middleware
This commit is contained in:
parent
1e61052ec1
commit
54313fe21b
2
main.go
2
main.go
@ -8,6 +8,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
func executeTemplate(w http.ResponseWriter, filepath string) {
|
func executeTemplate(w http.ResponseWriter, filepath string) {
|
||||||
@ -47,6 +48,7 @@ func notFoundHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
r := chi.NewRouter()
|
r := chi.NewRouter()
|
||||||
|
r.Use(middleware.Logger)
|
||||||
r.Get("/", homeHandler)
|
r.Get("/", homeHandler)
|
||||||
r.Get("/contact", contactHandler)
|
r.Get("/contact", contactHandler)
|
||||||
r.Get("/faq", faqHandler)
|
r.Get("/faq", faqHandler)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user