Dockerized fastapi client-server application (no db yet)
This service is designed to receive a request with a cadastral number, latitude and longitude. It emulates sending the request to an external server and a 45-seconds delay. Once processed, it returns the result of the request. The external server is expected to respond with either "true" or "false". Both client and server sides are deployed in the single Docker container.
The service provides the following endpoints:
This endpoint is used to submit a request. It accepts a POST request with the following parameters:
- number (string/float): the cadastral number associated with the request;
- latitude (strict float): the latitude value for the request;
- longitude (strict float): the longitude value for the request.
POST /query/
Content-Type: application/json
{
"number": "1234567890",
"latitude": 40.7128,
"longitude": -74.0060
}
This endpoint is used to send the previously processed and validated request data to the emulated server. It accepts a POST request and returns the result of the request as a JSON object. The result can be either true or false. At this moment this endpoint is being used within the service, after the conversion of the query data into the dictionary. In case of separate usage the data will not be validated.
This endpoint is used to check if the server is running. It accepts a GET request and returns a simple "pong" response.
Example Response:
GET /ping/
"pong"
-
Clone the project from the GitHub repository. You can use the
git clone
command and provide the repository URL. -
Navigate to the project directory using the
cd
command. -
Make sure you have Docker and Docker Compose installed on your machine. If not, follow the instructions to install Docker and Docker Compose.
Run the command docker-compose up --build
to start the project. This command will build the Docker container and launch it.