You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
530 B

10 years ago
  1. package rpc
  2. import (
  3. "fmt"
  4. "net/http"
  5. . "github.com/tendermint/tendermint/config"
  6. . "github.com/tendermint/tendermint/common"
  7. )
  8. func StartHTTPServer() {
  9. http.HandleFunc("/block", BlockHandler)
  10. // Serve HTTP on localhost only.
  11. // Let something like Nginx handle HTTPS connections.
  12. address := fmt.Sprintf("127.0.0.1:%v", Config.RPC.HTTPPort)
  13. log.Info(Fmt("Starting RPC HTTP server on http://%s", address))
  14. go func() {
  15. log.Crit("%v", http.ListenAndServe(address, RecoverAndLogHandler(http.DefaultServeMux)))
  16. }()
  17. }