Browse Source

Fix old documentation

Carl Jackson 12 years ago
parent
commit
4ed96805c3
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      web/web.go

+ 2
- 2
web/web.go View File

@ -30,11 +30,11 @@ Use your favorite HTTP verbs:
Bind parameters using either Sinatra-like patterns or regular expressions: Bind parameters using either Sinatra-like patterns or regular expressions:
m.Get("/hello/:name", func(c *web.C, w http.ResponseWriter, r *http.Request) {
m.Get("/hello/:name", func(c web.C, w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, %s!", c.UrlParams["name"]) fmt.Fprintf(w, "Hello, %s!", c.UrlParams["name"])
}) })
pattern := regexp.MustCompile(`^/ip/(?P<ip>(?:\d{1,3}\.){3}\d{1,3})$`) pattern := regexp.MustCompile(`^/ip/(?P<ip>(?:\d{1,3}\.){3}\d{1,3})$`)
m.Get(pattern, func(c *web.C, w http.ResponseWriter, r *http.Request) {
m.Get(pattern, func(c web.C, w http.ResponseWriter, r *http.Request) {
fmt.Printf(w, "Info for IP address %s:", c.UrlParams["ip"]) fmt.Printf(w, "Info for IP address %s:", c.UrlParams["ip"])
}) })


Loading…
Cancel
Save