Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
remove un-needed endpoints and handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech committed May 17, 2024
1 parent fe0a696 commit d6e031b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 48 deletions.
44 changes: 0 additions & 44 deletions handlers.go
Original file line number Diff line number Diff line change
@@ -1,55 +1,11 @@
package main

import (
"context"
"net/http"
"strconv"

"github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
)

func index(c echo.Context) error {
return c.String(http.StatusOK, "RealTime Hog 3000")
}

func pgVersion(c echo.Context) error {
conn := getPGConn()
defer conn.Close(context.Background())

var version string
err := conn.QueryRow(context.Background(), "select version()").Scan(&version)
if err != nil {
c.Logger().Error("cannot get row: %v", err)
}

return c.String(http.StatusOK, version)
}

func getToken(c echo.Context) error {
teamIdStr := c.QueryParam("teamId")
teamId, err := strconv.Atoi(teamIdStr)
if err != nil {
return err
}

token, err := tokenFromTeamId(teamId)
if err != nil {
log.Error("query error")
return err
}

return c.String(http.StatusOK, token)
}

func getPerson(c echo.Context) error {
distinctId := c.QueryParam("distinctId")

personId, err := personFromDistinctId(distinctId)
if err != nil {
log.Error("query error")
return err
}

return c.String(http.StatusOK, strconv.Itoa(personId))
}
4 changes: 0 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ func main() {
}
})

e.GET("/version", pgVersion)
e.GET("/token", getToken)
e.GET("/person", getPerson)

if !viper.GetBool("prod") {
e.Logger.Fatal(e.Start(":8080"))
} else {
Expand Down

0 comments on commit d6e031b

Please sign in to comment.