Skip to content

Commit

Permalink
Add routes to same group (APIRoute) (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-grassl authored and muXxer committed Jun 28, 2024
1 parent d767ae5 commit 5fbb993
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion components/poi/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ func run() error {

Component.LogInfo("Starting API server ...")

setupRoutes(e)
setupRoutes(e.Group(APIRoute))

go func() {
Component.LogInfof("You can now access the API using: http://%s", ParamsRestAPI.BindAddress)
if err := e.Start(ParamsRestAPI.BindAddress); err != nil && !errors.Is(err, http.ErrServerClosed) {
Expand Down
6 changes: 3 additions & 3 deletions components/poi/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const (
RouteValidateProof = "/validate"
)

func setupRoutes(e *echo.Echo) {
func setupRoutes(routeGroup *echo.Group) {

e.GET(RouteCreateProof, func(c echo.Context) error {
routeGroup.GET(RouteCreateProof, func(c echo.Context) error {
resp, err := createProof(c)
if err != nil {
return err
Expand All @@ -29,7 +29,7 @@ func setupRoutes(e *echo.Echo) {
return httpserver.JSONResponse(c, http.StatusOK, resp)
})

e.POST(RouteValidateProof, func(c echo.Context) error {
routeGroup.POST(RouteValidateProof, func(c echo.Context) error {
resp, err := validateProof(c)
if err != nil {
return err
Expand Down

0 comments on commit 5fbb993

Please sign in to comment.