Skip to content

Commit

Permalink
docs: update create example
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad committed Jun 8, 2024
1 parent 116baae commit 25e19d9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,15 @@ greeting := pb.NewGreetingServiceClient(grpcConn)
greetingService := pb.NewGreetingServiceJsonRpcService(greeting)

jgw := jrpc.NewServer()
jgw.RegisterServices(&greetingService)
jgw.RegisterServices(greetingService)

// json-rpc listener
lis, err = net.Listen("tcp", "localhost:8687")
if err != nil {
log.Fatalln(err)
}
mux := http.NewServeMux()
mux.HandleFunc("/", jgw.HttpHandler)
server := &http.Server{
Handler: mux,
Addr: lis.Addr().String(),
ReadHeaderTimeout: 3 * time.Second,
}

if err := server.Serve(lis); err != nil {
if err := jgw.Serve(lis); err != nil {
log.Fatalln(err)
}
```
Expand Down

0 comments on commit 25e19d9

Please sign in to comment.