tendermint/rpc/http_server.go

22 lines
531 B
Go
Raw Normal View History

2014-11-27 04:04:07 -08:00
package rpc
import (
"net/http"
2014-12-29 18:09:06 -08:00
. "github.com/tendermint/tendermint/common"
2015-01-06 15:51:41 -08:00
. "github.com/tendermint/tendermint/config"
2014-11-27 04:04:07 -08:00
)
func StartHTTPServer() {
2015-01-07 01:15:39 -08:00
http.HandleFunc("/blockchain", BlockchainInfoHandler)
http.HandleFunc("/block", BlockHandler)
http.HandleFunc("/broadcast_tx", BroadcastTxHandler)
2014-11-27 04:04:07 -08:00
2015-01-06 15:51:41 -08:00
log.Info(Fmt("Starting RPC HTTP server on %s", Config.RPC.HTTPLAddr))
2014-11-27 04:04:07 -08:00
go func() {
2015-01-06 15:51:41 -08:00
log.Crit("RPC HTTPServer stopped", "result", http.ListenAndServe(Config.RPC.HTTPLAddr, RecoverAndLogHandler(http.DefaultServeMux)))
2014-11-27 04:04:07 -08:00
}()
}