- Git
- Docker
-
Clone the repository:
git clone https://github.com/DanieleBelfiore/captcha-api.git cd captcha-api
-
Create a
.env
file for environment variables: Create a file named.env
in the project root with the following content:DATABASE_URL=postgresql://postgres:password@db:5432/captcha_api POSTGRES_USER=postgres POSTGRES_PASSWORD=password POSTGRES_DB=captcha_api
-
Build and run the application:
docker-compose up --build
This command will build the Docker images for the services defined in the
docker-compose.yml
file and start the containers. -
Access the application: Open your browser and navigate to
http://localhost:8000
.
- URL:
/captcha
- Method:
GET
- Response:
{ "id": 1, "image": "<base64_image_data>" }
- URL:
/captcha/validate
- Method:
POST
- Request Body:
{ "id": 1, "text": "ABC123" }
- Response:
{ "valid": false }
pytest