Created
August 16, 2021 18:58
-
-
Save jasonsalas/22e3dbbd48e918486263aac91128a7bb to your computer and use it in GitHub Desktop.
gRPC server-side streaming in Go - server application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"github.com/jasonsalas/protobank/internal/transaction" | |
bank "github.com/jasonsalas/protobank/pkg/protobuf/bank" | |
"google.golang.org/grpc" | |
) | |
func main() { | |
fmt.Println("starting server") | |
listener, err := net.Listen("tcp", ":50051") | |
if err != nil { | |
log.Fatalln(err) | |
} | |
grpcServer := grpc.NewServer() | |
trxServer := transaction.NewServer() | |
bank.RegisterTransactionServiceServer(grpcServer, trxServer) | |
log.Fatalln(grpcServer.Serve(listener)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment