Skip to content

Deflaus/Note-Management-App-Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Note Management App Backend

API for Note Management application

alt text

Development

Up and build containers

docker-compose up -d --build

Install poetry

pip install poetry

Install the project dependencies

cd src && poetry install

Spawn a shell within the virtual environment

poetry shell

Run dev server

python manage.py runserver

Import env

export $(grep -v "^#" .env.local | xargs)

Run tests

pytest

Start server

Start dev server

docker-compose up -d --build

pip install poetry
cd src && poetry install
poetry shell

python manage.py runserver

Use via swagger

  1. Go to http://localhost:8000/api/docs/
  2. After sign_up or sign_in use the token from the response body and place it in the Authorize form with the pattern
Token {your_token}
  1. Use swagger

Use via curl

  1. Sign up
curl -X 'POST' \
  'http://localhost:8000/api/auth/sign_up/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "string",
  "password": "string"
}'

Response body

{
  "pk": 1,
  "username": "string",
  "is_active": true,
  "token": "95bf3f893540a8743710cee91afe7ae20542c4f4"
}

After sign_up use the token from the response body and place it in the Authorization header with the pattern

Token {your_token}
  1. Create note
curl -X 'POST' \
  'http://localhost:8000/api/notes/' \
  -H 'accept: application/json' \
  -H 'Authorization: Token your_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "description": "string"
}'

Response body

{
  "pk": 1,
  "name": "string",
  "description": "string",
  "created_at": "2023-03-13T08:25:21.876016Z"
}
  1. Get own notes
curl -X 'GET' \
  'http://localhost:8000/api/notes/' \
  -H 'accept: application/json' \
  -H 'Authorization: Token your_token'

Response body

[
  {
    "pk": 1,
    "name": "string",
    "description": "string",
    "created_at": "2023-03-13T08:25:21.876016Z"
  }
]
  1. Get own note by id = 1
curl -X 'GET' \
  'http://localhost:8000/api/notes/1/' \
  -H 'accept: application/json' \
  -H 'Authorization: Token your_token'

Response body

{
  "pk": 1,
  "name": "string",
  "description": "string",
  "created_at": "2023-03-13T08:25:21.876016Z"
}
  1. Update own note by id = 1
curl -X 'PATCH' \
  'http://localhost:8000/api/notes/1/' \
  -H 'accept: application/json' \
  -H 'Authorization: Token your_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "description": "string"
}'

Response body

{
  "pk": 1,
  "name": "string",
  "description": "string",
  "created_at": "2023-03-13T08:25:21.876016Z"
}
  1. Delete own note by id
curl -X 'DELETE' \
  'http://localhost:8000/api/note/1/' \
  -H 'accept: application/json' \
  -H 'Authorization: Token your_token' \

Response body - no body

  1. Sign in
curl -X 'POST' \
  'http://localhost:8000/api/auth/sign_in/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "string",
  "password": "string"
}'

Response body

{
  "pk": 1,
  "username": "string",
  "is_active": true,
  "token": "95bf3f893540a8743710cee91afe7ae20542c4f4"
}

After sign_in use the token from the response body and place it in the Authorization header with the pattern

Token {your_token}
  1. Sign out
curl -X 'POST' \
  'http://localhost:8000/api/auth/sign_out/' \
  -H 'accept: application/json' \
  -H 'Authorization: Token your_token'

Response body - no body

About

🐍 API for Note Management application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors