A simple weather mock API implemented in Rust using Actix Web. This API returns a static list of weather forecasts for a given location.
- Actix Web framework for building the API
- Tracing for logging and instrumentation
- Serde for serialization and deserialization
- Docker support for easy deployment
- Rust 1.54 or higher
- Docker (optional, for deployment)
-
Clone the repository:
git clone https://github.com/aortizpimentel/weather-mock-api.git cd weather-mock-api
-
Build the project:
cargo build --release
- Run the application:
cargo run --release
- Access the API:
The API will be available at
http://localhost:8080/forecasts?lat={latitude}&lon={longitude}
. Replace{latitude}
and{longitude}
with the desired coordinates.
-
Build the Docker image:
docker build -t weather-mock-api .
-
Run the Docker container:
docker run -p 8080:8080 --name weather-api weather-mock-api
-
Access the API:
The API will be available at
http://localhost:8080/forecasts?lat={latitude}&lon={longitude}
. Replace{latitude}
and{longitude}
with the desired coordinates.
-
Stop the Docker container:
docker stop weather-api
-
Remove the Docker container:
docker rm weather-api
- Fork the repository on GitHub
- Create a new branch for your changes
- Commit your changes to the new branch
- Submit a pull request to merge your changes into the main repository
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or need help, please open a new GitHub issue in this repository.
- The Rust programming language for its safety and performance features
- The Actix Web framework for its extensible and easy-to-use API
- The Serde library for its powerful serialization and deserialization capabilities
- The tracing crate for its excellent logging and instrumentation tools
Happy coding! 🚀