lotus/daemon/rpc.go

16 lines
349 B
Go
Raw Normal View History

package daemon
import (
"net/http"
"github.com/filecoin-project/go-lotus/api"
"github.com/filecoin-project/go-lotus/lib/jsonrpc"
)
2019-07-08 20:50:13 +00:00
func serveRPC(api api.API, addr string) error {
2019-07-08 12:46:30 +00:00
rpcServer := jsonrpc.NewServer()
rpcServer.Register("Filecoin", api)
http.Handle("/rpc/v0", rpcServer)
2019-07-08 20:50:13 +00:00
return http.ListenAndServe(addr, http.DefaultServeMux)
}