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)
|
2015-01-10 05:41:50 -08:00
|
|
|
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
|
|
|
}()
|
|
|
|
}
|