Languages: Português 🇧🇷 | English 🇨🇦
Este projeto implementa uma API em Golang que recebe um CEP válido e retorna as temperaturas da localidade correspondente em Celsius, Fahrenheit e Kelvin. A API faz parte do desafio técnico do curso de Pós-Graduação em Engenharia de Software GoExpert.
Você precisará das seguintes tecnologias abaixo:
- Docker 🐳
- Docker Compose 🐳
- GIT
- Postman ☄️ ou VS Code com a extensão REST Client instalada.
- Google Cloud SDK (opcional, para testes no Google Cloud Run)
-
Clone o repositório e entre no diretório do projeto.
git clone https://github.com/brunoliveiradev/Weather-API-GoExpertPostGrad.git cd Weather-API-GoExpertPostGrad
-
Execute o comando abaixo na pasta raiz do projeto para iniciar o ambiente de desenvolvimento:
docker compose up --build -d
Para parar os serviços:
docker compose down
-
A API estará disponível em
http://localhost:8080
🚀.
- Para testar localmente você pode usar os cURLS de exemplo dentro do arquivo
api/get_temperature.http
exemplo:curl http://localhost:8080/01001000
- Resposta esperada:
{ "temp_C": 28.5, "temp_F": 83.3, "temp_K": 301.5 }
A aplicação já está disponível no Google Cloud Run no seguinte
URL: https://weather-by-zipcode-api-4w3swr2nrq-rj.a.run.app
- Para testar no Google Cloud Run, você pode usar o Postman e o cURL de exemplo dentro do
arquivo
api/get_temperature.http
exemplo: - Cep Válido deve retornar
200
e o JSON com as temperaturas:curl https://weather-by-zipcode-api-4w3swr2nrq-rj.a.run.app/01001000
- Cep não encontrado deve retornar
404
comcan not find zipcode
:curl https://weather-by-zipcode-api-4w3swr2nrq-rj.a.run.app/99999999
- CEP inválido deve retornar
422
cominvalid zipcode
:curl https://weather-by-zipcode-api-4w3swr2nrq-rj.a.run.app/123456
This project implements an API in Golang that receives a valid zip code and returns the temperatures of the corresponding location in Celsius, Fahrenheit and Kelvin. The API is part of the technical challenge of the Postgraduate course in Software Engineering GoExpert.
You will need the following technologies below:
- Docker 🐳
- Docker Compose 🐳
- GIT
- Postman ☄️ ou VS Code with the REST Client extension installed.
- Google Cloud SDK (optional, for tests on Google Cloud Run)
- Clone the repository and navigate to the project directory.
git clone https://github.com/brunoliveiradev/Weather-API-GoExpertPostGrad.git cd Weather-API-GoExpertPostGrad
- Run the command below in the project root folder to start the development environment:
To stop the services:
docker compose up --build -d
docker compose down
- The API will be available at
http://localhost:8080
🚀. - To test locally you can use the example cURLS inside the
api/get_temperature.http
file example:curl http://localhost:8080/01001000
Expected response:
{
"temp_C": 28.5,
"temp_F": 83.3,
"temp_K": 301.5
}
The application is already available on Google Cloud Run at the following
URL: https://weather-by-zipcode-api-4w3swr2nrq-rj.a.run.app
- To test on Google Cloud Run, you can use Postman and the example cURL inside the
api/get_temperature.http
file example: - Valid Zipcode should return
200
and the JSON with the temperatures:curl https://weather-by-zipcode-api-4w3swr2nrq-rj.a.run.app/01001000
- Zipcode not found should return
404
withcan not find zipcode
:curl https://weather-by-zipcode-api-4w3swr2nrq-rj.a.run.app/89216369
- Invalid Zipcode should return
422
withinvalid zipcode
:curl https://weather-by-zipcode-api-4w3swr2nrq-rj.a.run.app/123456