gin/examples/app-engine/hello.go

23 lines
457 B
Go
Raw Permalink Normal View History

2014-07-03 00:08:37 +04:00
package hello
import (
"net/http"
"github.com/gin-gonic/gin"
)
// This function's name is a must. App Engine uses it to drive the requests properly.
2014-07-03 00:08:37 +04:00
func init() {
// Starts a new Gin instance with no middle-ware
r := gin.New()
// Define your handlers
r.GET("/", func(c *gin.Context){
c.String(200, "Hello World!")
})
r.GET("/ping", func(c *gin.Context){
2014-07-03 00:08:37 +04:00
c.String(200, "pong")
})
// Handle all requests using net/http
http.Handle("/", r)
}