tendermint/rpc/http_server.go

24 lines
689 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-08 16:40:23 -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)
http.HandleFunc("/gen_priv_account", GenPrivAccountHandler)
http.HandleFunc("/sign_send_tx", SignSendTxHandler)
2014-11-27 04:04:07 -08:00
2015-01-08 16:40:23 -08:00
log.Info(Fmt("Starting RPC HTTP server on %s", config.App.GetString("RPC.HTTP.ListenAddr")))
2014-11-27 04:04:07 -08:00
go func() {
2015-01-08 16:40:23 -08:00
log.Crit("RPC HTTPServer stopped", "result", http.ListenAndServe(config.App.GetString("RPC.HTTP.ListenAddr"), RecoverAndLogHandler(http.DefaultServeMux)))
2014-11-27 04:04:07 -08:00
}()
}