wallet/pkg/rest/routes.go

38 lines
852 B
Go
Raw Normal View History

2024-08-31 14:46:20 +00:00
package rest
import (
docs "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
}