Skip to content

Commit 5461922

Browse files
authored
docs(guide/hello): revert grpc registration removal (ignite#2819)
Fix ignite#2817 There's 2 reasons why the change should be reverted: - the version that does the registration automatically is not released yet (0.24) - the hello tutorial requires the use of cli 0.22, where the registration is always manual. What could be changed in the 0.24 documentation: - remove the 0.22 requirement (latest could be used w/o any problem I think) - remove the manual grpc registration.
1 parent 971902f commit 5461922

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

docs/docs/guide/02-hello.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,39 @@ func (k Keeper) Hello(c context.Context, req *types.QueryHelloRequest) (*types.Q
227227
```
228228

229229
- Save the file to restart your chain.
230-
- After the chain has been started, visit [http://localhost:1317/hello/hello/hello](http://localhost:1317/hello/hello/hello) and see your text displayed:
230+
- In a web browser, visit the `hello` endpoint [http://localhost:1317/hello/hello/hello](http://localhost:1317/hello/hello/hello).
231+
232+
Because the query handlers are not yet registered with gRPC, you see a not implemented or localhost cannot connect error. This error is expected behavior, because you still need to register the query handlers.
233+
234+
## Register query handlers
235+
236+
Make the required changes to the `x/hello/module.go` file.
237+
238+
1. Add `"context"` to the list of packages in the import statement.
239+
240+
```go
241+
import (
242+
// ...
243+
244+
"context"
245+
246+
// ...
247+
)
248+
```
249+
250+
Do not save the file yet, you need to continue with these modifications.
251+
252+
1. Search for `RegisterGRPCGatewayRoutes`.
253+
254+
1. Register the query handlers:
255+
256+
```go
257+
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
258+
types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
259+
}
260+
```
261+
262+
2. After the chain has been started, visit [http://localhost:1317/hello/hello/hello](http://localhost:1317/hello/hello/hello) and see your text displayed:
231263

232264
```json
233265
{

0 commit comments

Comments
 (0)