Skip to content

Commit

Permalink
update RegisterSwaggerAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
skyargos committed Oct 17, 2024
1 parent b769151 commit 7747af3
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package app
import (
"encoding/json"
"io"
"net/http"
"os"

"cosmossdk.io/client/v2/autocli"
Expand All @@ -23,8 +22,6 @@ import (
abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
tmos "github.com/cometbft/cometbft/libs/os"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"

dbm "github.com/cosmos/cosmos-db"
Expand Down Expand Up @@ -853,8 +850,8 @@ func (app *ShentuApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.API
app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// register swagger API from root so that other applications can override easily
if apiConfig.Swagger {
RegisterSwaggerAPI(clientCtx, apiSvr.Router)
if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil {
panic(err)
}
}

Expand Down Expand Up @@ -882,17 +879,6 @@ func (app *ShentuApp) RegisterUpgradeHandlers() {
app.setUpgradeHandler(app.appCodec, app.IBCKeeper.ClientKeeper)
}

// RegisterSwaggerAPI registers swagger route with API Server
func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) {
statikFS, err := fs.New()
if err != nil {
panic(err)
}

staticServer := http.FileServer(statikFS)
rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer))
}

// initParamsKeeper init params keeper and its subspaces
func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper {
paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey)
Expand Down

0 comments on commit 7747af3

Please sign in to comment.