Skip to content

⏰Simply To Do Web Application Backend with Python, Django 🐍

License

Notifications You must be signed in to change notification settings

alstn2468/redux-todo-web-backend

Repository files navigation

Redux ToDo Web Backend

CircleCI codecov MIT License
Python Version Django Version Generic badge

Author : Kim Minsu
[ Facebook ] [ Github ] [ LinkedIn ] [ Blog ]

This repository is backend server of this Redux_ToDo_Web repository.

Function

⏰ To Do

  • Connect to Front-End Web Application
  • Implement authentication logic using jwt
  • Implement kakao oauth
  • Implement github oauth
  • Implement google oauth
  • Deploy to Heroku using Circle CI
  • More detailed exception handling

📝 Document

Login

1️⃣ Request
POST /login
2️⃣ Parameter
Name Description Required
user Username to login
password Password to login
3️⃣ Response
Name Description
access_token Tokens to access API that you put in the Authorization header
error Message in case of error
4️⃣ Sample
  • Success
HTTP/1.1 200 OK
Content-Type: application/json
{
    "access_token": "xxxxxxxyyyyyyyzzzzzzz",
    "user": "username"
}
  • Fail
HTTP/1.1 401 BAD REQUEST
Content-Type: application/json
{
    "error": "Invalid form. Please fill it out again."
}

Sign Up

1️⃣ Request
POST /signup
2️⃣ Parameter
Name Description Required
user Username to login
password Password to login
passwordConfirm Same data as password for password verification
3️⃣ Response
Name Description
access_token Tokens to access API that you put in the Authorization header
error Message in case of error
4️⃣ Sample
  • Success
HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "access_token": "xxxxxxxyyyyyyyzzzzzzz",
    "user": "username"
}
  • Fail
HTTP/1.1 401 BAD REQUEST
Content-Type: application/json
{
    "error": "Duplicate user name. Please use a different name."
}

Get all todo items

1️⃣ Request
GET /todo
Authorization: {access_token}
2️⃣ Parameter
Name Description Required
- - -
3️⃣ Response
Name Description
data Array consisting of todo item objects
error Message in case of error
4️⃣ Sample
  • Success
HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": [
        { "id": 1, "text": "todo 1", "isCompleted": true, "user": 1 },
        { "id": 2, "text": "todo 2", "isCompleted": false, "user": 1 },
        { "id": 3, "text": "todo 3", "isCompleted": true, "user": 1 }
    ]
}
  • Fail
HTTP/1.1 500 INTERNAL SERVER ERROR
Content-Type: application/json
{
    "error": "An error has occurred. Please try again."
}

Create one todo item

1️⃣ Request
POST /todo
Authorization: {access_token}
2️⃣ Parameter
Name Description Required
text Todo item text to be created
3️⃣ Response
Name Description
data Created todo item object
error Message in case of error
4️⃣ Sample
  • Success
HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": { 
        "id": 4, 
        "text": "todo 4", 
        "isCompleted": false, 
        "user": 1 
    }
}
  • Fail
HTTP/1.1 500 INTERNAL SERVER ERROR
Content-Type: application/json
{
    "error": "An error has occurred. Please try again."
}

Remove all completed todo items

1️⃣ Request
DELETE /todo
Authorization: {access_token}
2️⃣ Parameter
Name Description Required
- - -
3️⃣ Response
Name Description
error Message in case of error
4️⃣ Sample
  • Success
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
  • Fail
HTTP/1.1 500 INTERNAL SERVER ERROR
Content-Type: application/json
{
    "error": "An error has occurred. Please try again."
}

Updated one todo item

1️⃣ Request
PUT /todo/:id
Authorization: {access_token}
2️⃣ Parameter
Name Description Required
id Unique id of item to be updated
text Text of item to be updated -
isCompleted Completion of item to be updated -
3️⃣ Response
Name Description
data Updated todo item object
error Message in case of error
4️⃣ Sample
  • Success
HTTP/1.1 200 OK
Content-Type: application/json
{
    "data": { 
        "id": 4, 
        "text": "Updated Item", 
        "isCompleted": true, 
        "user": 1 
    }
}
  • Fail
HTTP/1.1 500 INTERNAL SERVER ERROR
Content-Type: application/json
{
    "error": "An error has occurred. Please try again."
}

Delete one todo item

1️⃣ Request
DELETE /todo/:id
Authorization: {access_token}
2️⃣ Parameter
Name Description Required
- - -
3️⃣ Response
Name Description
error Message in case of error
4️⃣ Sample
  • Success
HTTP/1.1 204 NO CONTENT
Content-Type: application/json
  • Fail
HTTP/1.1 500 INTERNAL SERVER ERROR
Content-Type: application/json
{
    "error": "An error has occurred. Please try again."
}