raulxiloj / todo-list

API made with Django

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Todo List

Simple Todo List where you can create tasks, check them as done, edit the description and delete them. This project was made with React, Django, MySql and Docker.

Run the project

As we use Docker there´s the advantage that everything you need to run this project is Docker. There are two separate containers one for the backend and one for the frontend. To run both I used Docker-Compose.

docker-compose up --build
  • This command will up the two 'services' defined in the docker-compose.yml file.

The API is running on the port 8000 in localhost. And the frontend is running on a nginx so the default port is 80.

API description

Besides the default tables that django creates the tables added with the models created are the following ones:

Endpoints created for tasks

Create

  • This endpoint is for creating a new task
POST: /api/task/tasks
body: {
    description: "Testing the API",
    status: false,
    tags: [1] #optional, #This field can be sended as an empty array
}

List

  • This endpoint is for list all the tasks created with their tags associated
GET: /api/task/tasks

Update

  • This endpoint is for updating certain fields of the task (status, description, tags)
PATCH: /api/task/tasks/:id
{
    status: true
}

Delete

  • This endpoint is for deleting a task
DELETE /api/task/tasks/:id

To follow the python standard I used a package named flake8 which check your code for identation, spaces, comments, length of a line, etc.

Also I try to follow TDD which is in generally words to make a test first and then create the code to that test pass.

Commands runned

  • To start django project

    django-admin startproject app .
    
  • To create a module

    python manage.py startapp core
    
  • For migrations

    python manage.py makemigrations core
    
    python manage.py migrate
    
  • To run the server

    python manage.py runserver 0.0.0.0:8000
    

Simple video running the app

Screen.Recording.2022-04-26.at.08.10.53.mov

Tools used

  • Django
    • djangorestframework
    • flake8
    • django-cors-headers
    • mysqlclient
  • React
  • Docker and docker-compose
  • Mysql

References

About

API made with Django

License:MIT License


Languages

Language:Python 58.5%Language:JavaScript 27.9%Language:HTML 8.3%Language:CSS 3.4%Language:Dockerfile 1.9%