diff --git a/CHANGELOG.md b/CHANGELOG.md index 58941a87..7f675ba6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,13 @@ Contains bug fixes. Contains all the PRs that improved the code without changing the behaviours. --> -## [v5.0.0] +## [v5.0.1](https://github.com/archway-network/archway/releases/tag/v5.0.1) + +### Fixed + +- [#497](https://github.com/archway-network/archway/pull/497) - Fix rest endpoints in App. Cherrypicked [#496](https://github.com/archway-network/archway/pull/496) - Fix rest endpoints in App + +## [v5.0.0](https://github.com/archway-network/archway/releases/tag/v5.0.0) ### Added diff --git a/app/app.go b/app/app.go index 64d51f2b..0461fa26 100644 --- a/app/app.go +++ b/app/app.go @@ -3,10 +3,11 @@ package app import ( "fmt" "io" - "net/http" "os" "path/filepath" + "github.com/cosmos/cosmos-sdk/server" + "github.com/archway-network/archway/app/keepers" "github.com/archway-network/archway/x/genmsg" @@ -119,8 +120,6 @@ import ( ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - "github.com/gorilla/mux" - "github.com/rakyll/statik/fs" "github.com/spf13/cast" "github.com/archway-network/archway/wasmbinding" @@ -926,9 +925,10 @@ func (app *ArchwayApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.AP // Register node gRPC service for grpc-gateway. nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - // register swagger API from root so that other applications can override easily - if apiConfig.Swagger { - RegisterSwaggerAPI(apiSvr.Router) + ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { + panic(err) } } @@ -951,17 +951,6 @@ func (app *ArchwayApp) AppCodec() codec.Codec { return app.appCodec } -// RegisterSwaggerAPI registers swagger route with API Server -func RegisterSwaggerAPI(rtr *mux.Router) { - statikFS, err := fs.New() - if err != nil { - panic(err) - } - - staticServer := http.FileServer(statikFS) - rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) -} - // GetMaccPerms returns a copy of the module account permissions func GetMaccPerms() map[string][]string { dupMaccPerms := make(map[string][]string)