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-06 15:51:41 -08:00
|
|
|
http.HandleFunc("/block", BlockchainInfoHandler)
|
2014-12-31 22:42:37 -08:00
|
|
|
http.HandleFunc("/mempool", MempoolHandler)
|
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
|
|
|
}()
|
|
|
|
}
|