Testing gRPC
- Web/Server framework with Golang.
- API Networking gRPC.
- API Networking [REST]
- Containerization Docker
# 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
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"
}
- 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.