-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
2,765 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,14 @@ import ( | |
|
||
"github.com/gin-gonic/gin" | ||
"github.com/spf13/cobra" | ||
swaggerFiles "github.com/swaggo/files" | ||
ginSwagger "github.com/swaggo/gin-swagger" | ||
|
||
"github.com/thirdweb-dev/indexer/internal/handlers" | ||
"github.com/thirdweb-dev/indexer/internal/middleware" | ||
|
||
// Import the generated Swagger docs | ||
_ "github.com/thirdweb-dev/indexer/docs" | ||
) | ||
|
||
var ( | ||
|
@@ -21,11 +26,31 @@ var ( | |
} | ||
) | ||
|
||
// @title Thirdweb Insight | ||
// @version 0.0.1 | ||
// @description API for querying blockchain transactions and events | ||
// @termsOfService http://swagger.io/terms/ | ||
|
||
// @contact.name Thirdweb Support | ||
// @contact.url https://thirdweb.com/support | ||
// @contact.email [email protected] | ||
|
||
// @license.name Apache 2.0 | ||
// @license.url https://github.com/thirdweb-dev/indexer/blob/main/LICENSE | ||
|
||
// @host localhost:3000 | ||
// @BasePath / | ||
|
||
// @securityDefinitions.basic BasicAuth | ||
|
||
func RunApi(cmd *cobra.Command, args []string) { | ||
r := gin.New() | ||
r.Use(gin.Logger()) | ||
r.Use(gin.Recovery()) | ||
|
||
// Add Swagger route | ||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) | ||
|
||
root := r.Group("/:chainId") | ||
{ | ||
root.Use(middleware.Authorization) | ||
|
Oops, something went wrong.