Skip to content

Commit

Permalink
- updates the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kodeart committed Aug 9, 2024
1 parent 9e77318 commit dcb5917
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ func NotFoundHandler() http.HandlerFunc {

// or with helper methods

func NotFoundHandler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
problem.New().
WithStatus(http.StatusNotFound).
WithDetail("No such API route").
WithTitle("Route Not Found").
WithInstance(r.URL.Path).
JSON(w)
}
func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
problem.New().
WithStatus(http.StatusNotFound).
WithDetail("No such API route").
WithTitle("Route Not Found").
WithInstance(r.URL.Path).
JSON(w)
}
```

Expand All @@ -64,7 +62,7 @@ import (

func main() {
mux := chi.NewRouter()
mux.NotFound(middleware.NotFoundHandler())
mux.NotFound(middleware.NotFoundHandler)

...

Expand Down

0 comments on commit dcb5917

Please sign in to comment.