Skip to content

Commit

Permalink
fix(app): rest endpoints (#497)
Browse files Browse the repository at this point in the history
* fix(app): rest endpoints (#496)

* fix rest

* CHANGELOG.md

* lint fix

---------

Co-authored-by: Spoorthi Satheesha <[email protected]>

* Update CHANGELOG.md

---------

Co-authored-by: Frojdi Dymylja <[email protected]>
  • Loading branch information
spoo-bar and fdymylja authored Nov 2, 2023
1 parent ffde5eb commit 75443a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 6 additions & 17 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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)
Expand Down

0 comments on commit 75443a6

Please sign in to comment.