Add index endpoint handler
This commit is contained in:
parent
a70aac85e7
commit
6d66c5e1f4
1 changed files with 9 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/labstack/echo/v4/middleware"
|
"github.com/labstack/echo/v4/middleware"
|
||||||
"link/link"
|
"link/link"
|
||||||
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewServer(conf *koanf.Koanf, pool *pgxpool.Pool) *echo.Echo {
|
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) {
|
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)
|
link.AddHandlers(s, pool)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue