A simple API Rest to insert a user in database and consume a gRPC Server to get data from the zipCode.
POST /v1/users
Request Body
{
"document": "00011122233",
"name": "Gabriel",
"zipCode": "01234560",
"number": "01"
}
Response - 201
{
"message": "User successfully saved",
"document": "00011122233",
"name": "Gabriel",
"cep": "01234560",
"city": "City Name",
"neighborhood": "Neighborhood Name",
"street": "Street Name",
"number": "01"
}
- The API receives a request and requests to the gRPC Server with the zipCode to get data of the address.
- The Server requests to Viacep API and returns to the client.
- The client receives the response and saves the item in database and returns the response to the client.