Merge pull request #6 from SkuliOskarsson/patch-1

Fixed some more code in the readme file
This commit is contained in:
Manu Mtz.-Almeida 2014-07-02 11:12:14 +02:00
commit 10d988bf02

View File

@ -23,7 +23,7 @@ import "github.com/gin-gonic/gin"
func main() { func main() {
r := gin.Default() r := gin.Default()
r.GET("ping", func(c *gin.Context){ r.GET("/ping", func(c *gin.Context){
c.String(200, "pong") c.String(200, "pong")
}) })
@ -207,7 +207,7 @@ Using LoadHTMLTemplates()
func main() { func main() {
r := gin.Default() r := gin.Default()
r.LoadHTMLTemplates("templates/*") r.LoadHTMLTemplates("templates/*")
r.GET("index", func(c *gin.Context) { r.GET("/index", func(c *gin.Context) {
obj := gin.H{"title": "Main website"} obj := gin.H{"title": "Main website"}
c.HTML(200, "index.tmpl", obj) c.HTML(200, "index.tmpl", obj)
}) })
@ -250,7 +250,7 @@ func main() {
r := gin.New() r := gin.New()
r.Use(Logger()) r.Use(Logger())
r.GET("test", func(c *gin.Context){ r.GET("/test", func(c *gin.Context){
example := r.Get("example").(string) example := r.Get("example").(string)
// it would print: "12345" // it would print: "12345"