Skip to content

Commit

Permalink
feat(SPV-1475): register v2 swagger (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
pawellewandowski98 authored Feb 10, 2025
1 parent 5dac1a5 commit 23c44fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions actions/v2/base/routes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package base

import (
"net/http"

routes "github.com/bitcoin-sv/spv-wallet/server/handlers"
"github.com/gin-gonic/gin"
swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
)

// RegisterRoutes creates the specific package routes
func RegisterRoutes(handlersManager *routes.Manager) {
root := handlersManager.Get(routes.GroupRoot)

root.GET("v2/swagger", func(c *gin.Context) {
c.Redirect(http.StatusMovedPermanently, "v2/swagger/index.html")
})
root.StaticFile("/api/gen.api.yaml", "./api/gen.api.yaml")
root.GET("v2/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler, ginSwagger.URL("/api/gen.api.yaml")))
}
3 changes: 3 additions & 0 deletions actions/v2/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v2

import (
"github.com/bitcoin-sv/spv-wallet/actions/v2/admin"
"github.com/bitcoin-sv/spv-wallet/actions/v2/base"
"github.com/bitcoin-sv/spv-wallet/actions/v2/data"
"github.com/bitcoin-sv/spv-wallet/actions/v2/operations"
"github.com/bitcoin-sv/spv-wallet/actions/v2/transactions"
Expand All @@ -17,4 +18,6 @@ func Register(handlersManager *handlers.Manager) {
data.RegisterRoutes(handlersManager)

admin.Register(handlersManager)

base.RegisterRoutes(handlersManager)
}

0 comments on commit 23c44fa

Please sign in to comment.