overflow_gateway_service/rpc_service.go

37 lines
567 B
Go
Raw Normal View History

2017-05-23 10:08:11 +00:00
package main
import (
"net"
"flag"
"github.com/golang/glog"
"google.golang.org/grpc"
pb "loafle.com/overflow/overflow_api_service/grpc"
"loafle.com/overflow/overflow_gateway_service/gateway"
)
func runRpc() error {
l, err := net.Listen("tcp", ":9090")
if err != nil {
return err
}
s := grpc.NewServer()
pb.RegisterOverflowGatewayServer(s, &gateway.ServiceImpl{})
s.Serve(l)
return nil
}
func main() {
flag.Parse()
defer glog.Flush()
gateway.InitServices()
if err := runRpc(); err != nil {
glog.Fatal("Gateway Server Failed: ", err)
}
}