3
0
Fork 0
mirror of https://gitea.com/docker/build-push-action.git synced 2024-11-29 12:59:37 +01:00
docker-build-push/test/go/main.go
CrazyMax 472ccddef1
test: go project sample
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-11 15:56:24 +01:00

31 lines
544 B
Go

package main
import (
"net/http"
"os"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
e := echo.New()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.GET("/", func(c echo.Context) error {
return c.HTML(http.StatusOK, "Hello World")
})
e.GET("/ping", func(c echo.Context) error {
return c.JSON(http.StatusOK, struct{ Status string }{Status: "OK"})
})
httpPort := os.Getenv("HTTP_PORT")
if httpPort == "" {
httpPort = "8080"
}
e.Logger.Fatal(e.Start(":" + httpPort))
}