This project is a country-service implemented in Rust programming language, utilizing the Diesel ORM for database interactions. The service provides operations for reading country data based on their code (alpha-2 code; ISO 3166), name, and by database identifier. country-service has three project:
- rest-service: REST server.
- grpc-service: gRpc server.
- shared. It is lib which contains shared logic for rest-service and grpc-service
- Find country by alpha-2 code
- Find countries by name
- Find country by database identifier
- Get all countries
- Diesel ORM for database operations
- Axum for REST operations
- Tonic for gRPC operations
-
Clone this repository:
git clone https://github.com/nenadjakic/country-service.git
cd country-service
-
Create a new database for the project.
-
Configure env variables:
Configure port and database connection url inside
.env
file -
Build and run the project:
cargo run -p country-rest-service
or
cargo run -p country-grpc-service
Note: The program will automatically apply migrations on startup.
Follow these steps to dockerize and run your application using Docker and Docker Compose:
-
Installing Docker and Docker Compose:
First, make sure Docker and Docker Compose are installed on your machine. If not, you can follow these guides:
-
Running Application with Docker Compose:
Use Docker Compose to build and run your application in a container:
docker compose up
This project is licensed under the MIT License - see the LICENSE file for details.