Todo API is a simple RESTful service for managing a to-do list, allowing users to create, read, update, and delete tasks.
-
Clone the repository:
git clone https://github.com/matheusgalvao1/todo-api.git cd todo-api
-
Build and start the application with Docker Compose:
docker-compose up --build -d
-
The API will be available at
http://localhost:8000
.
The API's authentication is configured through auth_config.yml
in the root directory:
-
No Authentication (
none
):auth: method: none
All endpoints will be public.
-
API Key Authentication (
api_key
):auth: method: api_key api_key: your-secure-api-key
Clients must include the API key in the
X-API-Key
header. -
JWT Authentication (
jwt
):auth: method: jwt secret: your-jwt-secret
Clients must obtain a JWT token via login/signup and include it in the
Authorization: Bearer <token>
header. -
Session Authentication (
session
):auth: method: session secret: your-session-secret
Uses browser sessions for authentication.
The project comes with initial data, seeded at startup:
- Todos:
initial_todos.json
- Users:
initial_users.json
Simply run:
python app/main.py
The API will read the configuration from auth_config.yml
. If the file doesn't exist, it will default to no authentication.
The application is containerized and exposes port 8000
, making it suitable for use as a sidecar in various deployment scenarios.
The Docker container exposes port 8000
, allowing the API to be accessed from other containers or services in the same network. In order to enable it in the task, you need to add the following to the task configuration:
- For PR testing:
ghcr.io/codesignal/learn_todo-api:<pr-number>
- Example:
ghcr.io/codesignal/learn_todo-api:pr-8
- Example:
- For main branch:
ghcr.io/codesignal/learn_todo-api:latest
The sidecar can be used in base tasks and other containerized environments where you need a todo API service.