1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/vendor/github.com/gin-gonic/gin/examples/app-engine/hello.go

25 lines
461 B
Go
Raw Normal View History

2017-10-03 21:43:55 +03: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.
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) {
c.String(200, "pong")
})
// Handle all requests using net/http
http.Handle("/", r)
}