@@ -42,9 +42,10 @@ func main() {
4242
4343 r.GET (" /" , func (c router.Context ) error {
4444 // c.Request() is original http.Request
45- // c.Response() is original http.ResponseWriter
45+ // c.Response() is original http.ResponseWriter
4646 return c.Text (http.StatusOK , " Hello from GoLobby Router!" )
4747 })
48+
4849 r.PUT (" /products/:id" , func (c router.Context ) error {
4950 return c.Text (http.StatusOK , " Update product with ID: " +c.Parameter (" id" ))
5051 })
@@ -153,13 +154,13 @@ func main() {
153154
154155 r.GET (" /links" , func (c router.Context ) error {
155156 return c.JSON (http.StatusOK , response.M {
156- // URL: /
157- " home" : c.URL (" home" , nil ),
158- // URL: /posts/1
159- " post-1" : c.URL (" post" , map [string ]string {" id" : " 1" }),
160- // URL: /posts/2
161- " post-2" : c.URL (" post" , map [string ]string {" id" : " 2" }),
162- })
157+ // "/"
158+ " home" : c.URL (" home" , nil ),
159+ // " /posts/1"
160+ " post-1" : c.URL (" post" , map [string ]string {" id" : " 1" }),
161+ // " /posts/2"
162+ " post-2" : c.URL (" post" , map [string ]string {" id" : " 2" }),
163+ })
163164 })
164165
165166 log.Fatalln (r.Start (" :8000" ))
@@ -168,7 +169,7 @@ func main() {
168169
169170### Responses
170171
171- The router comes with ` Empty ` , ` Redirect ` , ` Text ` , ` HTML ` , ` JSON ` , ` PrettyJSON ` , ` XML ` , and ` PrettyXML ` responses out of the box.
172+ The router comes with ` Empty ` , ` Redirect ` , ` Text ` , ` HTML ` , ` JSON ` , ` PrettyJSON ` , ` XML ` , ` PrettyXML ` , and ` Bytes ` responses out of the box.
172173The examples below demonstrate how to use built-in and custom responses.
173174
174175``` go
@@ -293,7 +294,7 @@ func main() {
293294
294295 r.WithMiddleware (AdminMiddleware, func () {
295296 r.GET (" /admin/users" , UsersHandler)
296- r.GET (" /admin/products" , ProductsHandler)
297+ r.GET (" /admin/products" , ProductsHandler)
297298 })
298299
299300 log.Fatalln (r.Start (" :8000" ))
@@ -343,7 +344,7 @@ func main() {
343344
344345 r.Group (" /blog" , []router.Middleware {Middleware1, Middleware2}, func () {
345346 r.GET (" /posts" , PostsHandler)
346- r.GET (" /posts/:id/comments" , CommentsHandler)
347+ r.GET (" /posts/:id/comments" , CommentsHandler)
347348 })
348349
349350 log.Fatalln (r.Start (" :8000" ))
@@ -475,7 +476,7 @@ func main() {
475476 return c.HTML (500 , " <p>Something went wrong</p>" )
476477 }
477478
478- // No error will raise to the router base handler
479+ // No error will raise to the router base handler
479480 return nil
480481 }
481482 })
0 commit comments