github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/bft/rpc/core/health.go (about)

     1  package core
     2  
     3  import (
     4  	ctypes "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"
     5  	rpctypes "github.com/gnolang/gno/tm2/pkg/bft/rpc/lib/types"
     6  )
     7  
     8  // Get node health. Returns empty result (200 OK) on success, no response - in
     9  // case of an error.
    10  //
    11  // ```shell
    12  // curl 'localhost:26657/health'
    13  // ```
    14  //
    15  // ```go
    16  // client := client.NewHTTP("tcp://0.0.0.0:26657", "/websocket")
    17  // err := client.Start()
    18  //
    19  //	if err != nil {
    20  //	  // handle error
    21  //	}
    22  //
    23  // defer client.Stop()
    24  // result, err := client.Health()
    25  // ```
    26  //
    27  // > The above command returns JSON structured like this:
    28  //
    29  // ```json
    30  //
    31  //	{
    32  //		"error": "",
    33  //		"result": {},
    34  //		"id": "",
    35  //		"jsonrpc": "2.0"
    36  //	}
    37  //
    38  // ```
    39  func Health(ctx *rpctypes.Context) (*ctypes.ResultHealth, error) {
    40  	return &ctypes.ResultHealth{}, nil
    41  }