A service that registers couriers, adds new orders, and assigns them to couriers.
- REST API with 7 basic methods.
- Courier rating calculation.
- Rate limiter for incoming requests.
POST /couriers
: Load couriers list.GET /couriers/{courier_id}
: Get specific courier info.GET /couriers
: Get all couriers info.POST /orders
: Add orders list.GET /orders/{order_id}
: Get specific order info.GET /orders
: Get all orders info with pagination.POST /orders/complete
: Mark orders as completed.
GET /couriers/meta-info/{courier_id}
: Get courier's earnings and rating.
- Limits load to 10 RPS for each endpoint.
-
Clone the project repository.
git clone <project-repo-url>
-
Build the Docker image and start the Docker container using Docker Compose.
docker-compose up --build
The application should now be running at http://localhost:8080
.
test.sh
will run the project tests in a Docker environment. Rate limiter is disabled while running the tests.
-
Ensure that the script is executable:
chmod +x test.sh
-
Run the tests:
bash test.sh
This script will:
- Build the Docker images and start the Docker containers using Docker Compose with disabled rate_limiter.
- Execute the test cases.
- Cleanup the Docker environment.
In case running the application using only Docker (without Docker Compose), follow the steps below.
-
Set up network
my-network
separately.docker network create my-network
-
Set up the database service
db
separately.docker run -d --name db -e POSTGRES_PASSWORD=password -p 5432:5432 --network my-network postgres
-
Build a Docker image from the Dockerfile. You can do this using the
docker build
command.docker build -t my-app .
-
After the image is built, you can run it using the
docker run
command.docker run -d --name app -p 8080:8080 --network my-network my-app