Skip to content

Commit 6e480a1

Browse files
author
Sergio Andres Virviescas Santana
committed
Rename router var to r
1 parent 00e0459 commit 6e480a1

File tree

5 files changed

+85
-85
lines changed

5 files changed

+85
-85
lines changed

examples/auth/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ func main() {
8080
user := "gordon"
8181
pass := "secret!"
8282

83-
router := router.New()
84-
router.GET("/", Index)
85-
router.GET("/protected/", BasicAuth(Protected, user, pass))
83+
r := router.New()
84+
r.GET("/", Index)
85+
r.GET("/protected/", BasicAuth(Protected, user, pass))
8686

87-
log.Fatal(fasthttp.ListenAndServe(":8080", router.Handler))
87+
log.Fatal(fasthttp.ListenAndServe(":8080", r.Handler))
8888
}
8989
```

examples/basic/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ func QueryArgs(ctx *fasthttp.RequestCtx) {
4343
}
4444

4545
func main() {
46-
router := router.New()
47-
router.GET("/", Index)
48-
router.GET("/hello/:name", Hello)
49-
router.GET("/multi/:name/:word", MultiParams)
50-
router.GET("/ping", QueryArgs)
46+
r := router.New()
47+
r.GET("/", Index)
48+
r.GET("/hello/:name", Hello)
49+
r.GET("/multi/:name/:word", MultiParams)
50+
r.GET("/ping", QueryArgs)
5151

52-
log.Fatal(fasthttp.ListenAndServe(":8080", router.Handler))
52+
log.Fatal(fasthttp.ListenAndServe(":8080", r.Handler))
5353
}
5454
```

examples/hosts/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ func (hs HostSwitch) CheckHost(ctx *fasthttp.RequestCtx) {
4848

4949
func main() {
5050
// Initialize a router as usual
51-
router := router.New()
52-
router.GET("/", Index)
53-
router.GET("/hello/:name", Hello)
51+
r := router.New()
52+
r.GET("/", Index)
53+
r.GET("/hello/:name", Hello)
5454

5555
// Make a new HostSwitch and insert the router (our http handler)
5656
// for example.com and port 12345
5757
hs := make(HostSwitch)
58-
hs["example.com:12345"] = router.Handler
58+
hs["example.com:12345"] = r.Handler
5959

6060
// Use the HostSwitch to listen and serve on port 12345
6161
log.Fatal(fasthttp.ListenAndServe(":12345", hs.CheckHost))

router.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
// }
2626

2727
// func main() {
28-
// router := router.New()
29-
// router.GET("/", Index)
30-
// router.GET("/hello/:name", Hello)
28+
// r := router.New()
29+
// r.GET("/", Index)
30+
// r.GET("/hello/:name", Hello)
3131

32-
// log.Fatal(fasthttp.ListenAndServe(":8080", router.Handler))
32+
// log.Fatal(fasthttp.ListenAndServe(":8080", r.Handler))
3333
// }
3434
//
3535
// The router matches incoming requests by the request method and the path.

0 commit comments

Comments
 (0)