From 6d66c5e1f494780b188fcc4b5955de47d6b6bb79 Mon Sep 17 00:00:00 2001 From: Andrey Chervyakov Date: Sat, 13 Mar 2021 18:49:20 +0600 Subject: [PATCH] Add index endpoint handler --- server.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server.go b/server.go index e668866..8e97c02 100644 --- a/server.go +++ b/server.go @@ -6,6 +6,7 @@ import ( "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "link/link" + "net/http" ) func NewServer(conf *koanf.Koanf, pool *pgxpool.Pool) *echo.Echo { @@ -30,5 +31,13 @@ func addMiddleware(s *echo.Echo, conf *koanf.Koanf) { } func addHandlers(s *echo.Echo, pool *pgxpool.Pool) { + s.GET("", func(ctx echo.Context) error { + return ctx.JSON(http.StatusOK, struct { + Message string `json:"message"` + }{ + Message: "Hello. This is my (https://cognio.dev/) URL shortener for easy access to my socials, projects and other resources.", + }) + }) + link.AddHandlers(s, pool) }