Skip to content

Implementation of a simple RPC service using Golang.

Notifications You must be signed in to change notification settings

penthaapatel/grpcblog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grpcblog

Here's is the link to my Medium article which explains the implementation of the code

Implementation of a simple RPC service using Golang. The RPC service can create and save blog posts.

  • Client sends a request to the server to create a blog post with a given title and content.
  • The server saves the blog posts created to an in-memory storage.
  • The blog posts created are also saved to a JSON file named blogs.json in the root directory.

Directory structure

grpcblog
├── Makefile
├── README.md
├── blog
│   ├── blog.pb.go
│   ├── blog.proto
│   └── blog_grpc.pb.go
├── blogs.json
├── client
│   └── client.go
├── client.png
├── go.mod
├── go.sum
├── serializer
│   └── json.go
├── server
│   └── server.go
├── server.png
└── storage
    └── storage.go

Generating protocol buffer code

make clean : To clean up the generated proto files

make gen : To compile the proto file

This generates two files:

blog/blog_grpc.pb.go
blog/blog.pb.go

blog_grpc.pb.go : contains server and client stubs.

blog.pb.go : contains protocol buffer related code - responsible for binary serialization of data when it is transported between server and client.

Running the server and client

Run the server and client code in two separate terminal windows:

go run server/server.go

Server

go run client/client.go

Client

About

Implementation of a simple RPC service using Golang.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published