Skip to content

Instantly share code, notes, and snippets.

@jasonsalas
Created August 16, 2021 18:58
Show Gist options
  • Save jasonsalas/22e3dbbd48e918486263aac91128a7bb to your computer and use it in GitHub Desktop.
Save jasonsalas/22e3dbbd48e918486263aac91128a7bb to your computer and use it in GitHub Desktop.
gRPC server-side streaming in Go - server application
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