Modified ping path and added a comment explaining why init() is called
like that.
This commit is contained in:
Javier Provecho Fernandez 2014-07-02 22:39:42 +02:00
parent f380265f5d
commit ca91a4a6da
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// This function's name is a must. App Engine uses it to drive the requests properly.
func init() { func init() {
// Starts a new Gin instance with no middle-ware // Starts a new Gin instance with no middle-ware
r := gin.New() r := gin.New()
@ -13,7 +14,7 @@ func init() {
r.GET("/", func(c *gin.Context){ r.GET("/", func(c *gin.Context){
c.String(200, "Hello World!") c.String(200, "Hello World!")
}) })
r.GET("/ping/", func(c *gin.Context){ r.GET("/ping", func(c *gin.Context){
c.String(200, "pong") c.String(200, "pong")
}) })