simple-go-action/main.go

19 lines
282 B
Go
Raw Permalink Normal View History

2023-04-17 13:52:29 +08:00
package main
import (
2024-08-13 10:56:07 +08:00
"net/http"
2023-04-17 13:52:29 +08:00
2024-08-13 10:56:07 +08:00
"github.com/gin-gonic/gin"
)
2024-08-13 09:28:33 +08:00
2023-04-17 13:52:29 +08:00
func main() {
2024-08-13 10:56:07 +08:00
r := gin.Default()
2024-08-13 11:30:05 +08:00
r.GET("/ping", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "pong",
})
2024-08-13 10:56:07 +08:00
})
2024-08-13 11:31:16 +08:00
2024-08-13 11:30:05 +08:00
r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
2024-08-13 10:56:07 +08:00
}