hello.go 457 B

1234567891011121314151617181920212223
  1. package hello
  2. import (
  3. "net/http"
  4. "github.com/gin-gonic/gin"
  5. )
  6. // This function's name is a must. App Engine uses it to drive the requests properly.
  7. func init() {
  8. // Starts a new Gin instance with no middle-ware
  9. r := gin.New()
  10. // Define your handlers
  11. r.GET("/", func(c *gin.Context){
  12. c.String(200, "Hello World!")
  13. })
  14. r.GET("/ping", func(c *gin.Context){
  15. c.String(200, "pong")
  16. })
  17. // Handle all requests using net/http
  18. http.Handle("/", r)
  19. }