hello/main.go

17 lines
344 B
Go
Raw Normal View History

2021-07-19 03:22:32 +00:00
package main
2021-07-19 05:18:57 +00:00
import "github.com/gin-gonic/gin"
2021-07-19 03:22:32 +00:00
func main() {
2021-07-19 05:18:57 +00:00
r := gin.Default()
r.LoadHTMLGlob("template/*html")
r.GET("/ping", func(c *gin.Context) {
// c.JSON(200, gin.H{
// "message": "pong",
// })
// c.HTML(200, "index.html", gin.H{})
c.String(200, "hello world", gin.H{})
})
r.Run() // listen and serve on 0.0.0.0:8080
2021-07-19 03:22:32 +00:00
}