This is a RESTful API for a Todo application built using Django and Django Rest Framework. The API allows users to create, read, update, and delete (CRUD) todo items.
- User authentication using JWT
- CRUD operations for todos
- API documentation using Swagger OpenAPI
- Django: Backend framework
- Django Rest Framework: For building the API
- JWT Authentication: For securing the API
- PostgreSQL: Database
- Docker: Containerization (optional)
Method | Endpoint | Description | Auth Required |
---|---|---|---|
POST | /api/auth/login/ |
Log in and get a JWT token | No |
GET | /api/todos/ |
Retrieve a list of todos | Yes |
POST | /api/todos/ |
Create a new todo | Yes |
GET | /api/todos/{id}/ |
Retrieve details of a specific todo | Yes |
PUT | /api/todos/{id}/ |
Update a todo entirely | Yes |
PATCH | /api/todos/{id}/ |
Update a todo | Yes |
DELETE | /api/todos/{id}/ |
Delete a todo | Yes |
-
Clone the repository:
git clone https://github.com/Mohammadreza-Alizadeh/Todo-App.git cd TODO-App/
-
Copy
.env.example
to.env
cp .env.example .env
-
Install the dependencies:
pip install -r requirements.txt
-
Run migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Run the development server:
python manage.py runserver
-
You can now access the API at
http://127.0.0.1:8000/
.
If you prefer to use Docker, follow these steps:
-
Copy
.env.example
to.env
cp .env.example .env
-
Build the Docker image:
docker compose build
-
Run the containers:
docker compose up
The API will be available at http://localhost:8000/
.