hello.go 372 B

12345678910111213141516171819202122
  1. package hello
  2. import (
  3. "net/http"
  4. "github.com/gin-gonic/gin"
  5. )
  6. func init() {
  7. // Starts a new Gin instance with no middle-ware
  8. r := gin.New()
  9. // Define your handlers
  10. r.GET("/", func(c *gin.Context){
  11. c.String(200, "Hello World!")
  12. })
  13. r.GET("/ping/", func(c *gin.Context){
  14. c.String(200, "pong")
  15. })
  16. // Handle all requests using net/http
  17. http.Handle("/", r)
  18. }