olamilekan000 / sosived

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sosived

Testing gRPC

Technologies

  • Web/Server framework with Golang.
  • API Networking gRPC.
  • API Networking [REST]
  • Containerization Docker

Getting started

# Clone the project
git clone https://github.com/olamilekan000/sosived.git
cd sosived

# Build and Run App
Docker-compose up or docker-compose build && docker-compose up

Documentation

User Login

  • API Endpoint
http://localhost:8989/auth/login
  • Request Payload
  POST {
	"username": "admin",
	"password": "password"
}
  • This should return a token
{
	"data": {
		"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NTQyMTQxMzcsImlhdCI6MTY1NDIxMjMzNywiaXNzIjoiYWRtaW4ifQ.bQDGfyVZwAFS7TkjyZf1RDSMWWyV0IlzeFVl8AUMRog"
	},
	"statusCode": 200,
	"message": "Authentication was successful"
}

Send Message - This basically just triggers the gRPC client and then stream messages to the RPC server and in return to the streams, a single response is gotten. (Client Streaming)

  • API Endpoint
http://localhost:8188/send-message
  • Request Payload
  POST {}
  • This should return a message and the logged in user name. You an also see the data being streamed by the client and also being processed by the server.
{
	"data": {
		"user": "admin"
	},
	"statusCode": 200,
	"message": "Processing Messages"
}

alt text

  • To trigger the message streaming, open up your browser and headover to the frontend app. Then log-in with the user name and password provided above.

About


Languages

Language:Go 64.5%Language:JavaScript 24.4%Language:HTML 7.9%Language:Makefile 1.8%Language:Dockerfile 1.4%