wallet/pkg/rest/routes.go
Anton Nesterov 1382da92a3
[init]
2024-08-31 16:46:20 +02:00

37 lines
879 B
Go

package rest
import (
docs "git.pspay.io/crypto-stories/custodial/docs"
gin "github.com/gin-gonic/gin"
swaggerfiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
)
func Router() *gin.Engine {
router := gin.Default()
router.LoadHTMLFiles("cmd/envcrypt.html")
docs.SwaggerInfo.BasePath = "/api/v1"
utils := router.Group("/utils")
utils.POST("/echo", EchoV1)
utils.GET("/envcrypt", func(c *gin.Context) {
c.HTML(200, "envcrypt.html", nil)
})
v1 := router.Group("/api/v1")
v1.Use(AuthMiddleware())
v1.Use(SyncMiddleware())
v1.POST("/export", ExportV1)
v1.POST("/export-batch", ExportBatchV1)
v1.GET("/export-spender-keys", ExportSpenderKeysV1)
AccountRestV1(v1.Group("/account"))
TronRestV1(v1.Group("/tron"))
EthRestV1(v1.Group("/eth"))
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
return router
}