Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Update samples to the last version.
  • Loading branch information
mariomenjr authored May 3, 2022
1 parent 71bd694 commit e616c4f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You can register paths and handlers directly:
func main() {
h := handlr.New()

h.Handler("/feed", feedHandler)
h.HandleFunc("/feed", feedHandler)

r.Start(1993)
}
Expand All @@ -55,8 +55,8 @@ You can also register `Route`s which allow you to organize your handlers (or eve
func main() {
h := handlr.New()

h.Route("/feed", feedRoute)
h.Route("/account", accountRoute)
h.RouteFunc("/feed", feedRoute)
h.RouteFunc("/account", accountRoute)

r.Start(1993)
}
Expand All @@ -66,17 +66,17 @@ func main() {
// feed.route.go

func feedRoute(r *handlr.Router) {
r.Handler("/latest", latestHandler)
r.HandleFunc("/latest", latestHandler)

r.Route("/custom", feedCustomRoute)
r.RouteFunc("/custom", feedCustomRoute)
}

func latestHandler(w http.ResponseWriter, r *http.Request) {
// ...
}

func feedCustomRoute(r *handlr.Router) {
r.Handler("/monthly", feedCustomMonthlyHandler)
r.HandleFunc("/monthly", feedCustomMonthlyHandler)
}

func feedCustomMonthlyHandler(w http.ResponseWriter, r *http.Request) {
Expand All @@ -88,8 +88,8 @@ func feedCustomMonthlyHandler(w http.ResponseWriter, r *http.Request) {
// account.route.go

func accountRoute(r *handlr.Router) {
r.Handler("/profile", accountProfileHandlr)
r.Handler("/settings", accountSettingsHandlr)
r.HandleFunc("/profile", accountProfileHandlr)
r.HandleFunc("/settings", accountSettingsHandlr)
}

func accountProfileHandlr(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit e616c4f

Please sign in to comment.