mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-20 18:26:46 +00:00
test: go project sample
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
d235d2d5ea
commit
472ccddef1
4 changed files with 104 additions and 0 deletions
31
test/go/main.go
Normal file
31
test/go/main.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
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))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue