diff --git a/app/routes.go b/app/routes.go new file mode 100644 index 0000000..ccb3190 --- /dev/null +++ b/app/routes.go @@ -0,0 +1,18 @@ +package app + +import ( + "net/http" + + "github.com/labstack/echo/v4" +) + +func (a *App) SetupRoutes() { + e := a.E() + + e.GET("/", func(c echo.Context) error { + return c.NoContent(http.StatusOK) + }) + e.HEAD("/", func(c echo.Context) error { + return c.NoContent(http.StatusOK) + }) +} diff --git a/run.go b/run.go index 1cf43dd..7173e32 100644 --- a/run.go +++ b/run.go @@ -10,7 +10,6 @@ import ( "git.dotya.ml/mirre-mt/pcmt/app" "git.dotya.ml/mirre-mt/pcmt/config" - "github.com/labstack/echo/v4" ) var ( @@ -37,9 +36,7 @@ func run() error { return err } - e.GET("/", func(c echo.Context) error { - return c.String(http.StatusOK, "Hello there.") - }) + a.SetupRoutes() go func() { if err = e.Start(*addr); err != nil && err != http.ErrServerClosed {