Merge pull request #18 from bluele/fixReadme

Fixes code examples in README
This commit is contained in:
Manu Mtz.-Almeida 2014-07-02 11:13:32 +02:00
commit 5eb5080c7c

View File

@ -61,6 +61,9 @@ func main() {
message := "Hello "+name message := "Hello "+name
c.String(200, message) c.String(200, message)
}) })
// Listen and server on 0.0.0.0:8080
r.Run(":8080")
} }
``` ```
@ -167,6 +170,9 @@ func main() {
} }
} }
}) })
// Listen and server on 0.0.0.0:8080
r.Run(":8080")
} }
``` ```
@ -195,6 +201,9 @@ func main() {
r.GET("/someXML", func(c *gin.Context) { r.GET("/someXML", func(c *gin.Context) {
c.XML(200, gin.H{"message": "hey", "status": 200}) c.XML(200, gin.H{"message": "hey", "status": 200})
}) })
// Listen and server on 0.0.0.0:8080
r.Run(":8080")
} }
``` ```
@ -211,6 +220,9 @@ func main() {
obj := gin.H{"title": "Main website"} obj := gin.H{"title": "Main website"}
c.HTML(200, "index.tmpl", obj) c.HTML(200, "index.tmpl", obj)
}) })
// Listen and server on 0.0.0.0:8080
r.Run(":8080")
} }
``` ```
@ -222,6 +234,9 @@ func main() {
r := gin.Default() r := gin.Default()
html := template.ParseFiles("file1", "file2") html := template.ParseFiles("file1", "file2")
r.HTMLTemplates = html r.HTMLTemplates = html
// Listen and server on 0.0.0.0:8080
r.Run(":8080")
} }
``` ```
@ -256,6 +271,9 @@ func main() {
// it would print: "12345" // it would print: "12345"
log.Println(example) log.Println(example)
}) })
// Listen and server on 0.0.0.0:8080
r.Run(":8080")
} }
``` ```