-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
53 lines (41 loc) · 1.15 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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 {
if err := c.HTML(http.StatusOK, "Uzaylılar tarafından kaçırıldım. Evet, tarafından."); err != nil {
return err
}
return nil
}).Name = "index"
e.GET("/about", func(c echo.Context) error {
if err := c.HTML(http.StatusOK, "Uzaylılar tarafından kaçırıldım. Evet, tarafından."); err != nil {
return err
}
return nil
})
e.GET("/ping", func(c echo.Context) error {
if err := c.JSON(http.StatusOK, struct{ Status string }{Status: "OK"}); err != nil {
return err
}
return nil
})
e.GET("/health", func(c echo.Context) error {
return c.JSON(http.StatusOK, struct{ Status string }{Status: "OK"})
}).Name = "health"
e.GET("/health/ping", func(c echo.Context) error {
return c.JSON(http.StatusOK, struct{ Status string }{Status: "OK"})
}).Name = "health-ping"
httpPort := os.Getenv("HTTP_PORT")
if httpPort == "" {
httpPort = "8080"
}
e.Logger.Fatal(e.Start(":" + httpPort))
}