mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-08 21:48:11 -05:00
Co-authored-by: georgehao <georgehao@users.noreply.github.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
31 lines
917 B
Go
31 lines
917 B
Go
package route
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gin-contrib/cors"
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"bridge-history-api/config"
|
|
"bridge-history-api/internal/controller"
|
|
)
|
|
|
|
// Route routes the APIs
|
|
func Route(router *gin.Engine, conf *config.Config) {
|
|
router.Use(cors.New(cors.Config{
|
|
AllowOrigins: []string{"*"},
|
|
AllowMethods: []string{"GET", "POST", "PUT", "DELETE"},
|
|
AllowHeaders: []string{"Origin", "Content-Type", "Authorization"},
|
|
AllowCredentials: true,
|
|
MaxAge: 12 * time.Hour,
|
|
}))
|
|
|
|
r := router.Group("api/")
|
|
r.GET("/txs", controller.HistoryCtrler.GetAllTxsByAddr)
|
|
r.POST("/txsbyhashes", controller.HistoryCtrler.PostQueryTxsByHash)
|
|
r.GET("/claimable", controller.HistoryCtrler.GetAllClaimableTxsByAddr)
|
|
r.GET("/withdraw_root", controller.BatchCtrler.GetWithdrawRootByBatchIndex)
|
|
r.GET("/health", controller.HealthCheck.HealthCheck)
|
|
r.GET("/ready", controller.Ready.Ready)
|
|
}
|