37 lines
567 B
Go
37 lines
567 B
Go
|
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)
|
||
|
}
|
||
|
}
|