Skip to content

RicardoRibeiroRodrigues/cryptowatchers-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cryptowatchers - Backend

The backend for the cryptoWatchers site project, the frontend with the explanation of the features and the live demo is linked here. The deployment of the backend can be seen here.

To run the backend localy:

  1. Clone the repo
git clone https://github.com/RicardoRibeiroRodrigues/cryptowatchers-backend/
  1. Make a virtual environment for the project:
python -m venv env
  1. Install the dependencies. In the project root (Remenber to activate the env):
pip install -r requirements.txt
  1. For a easier local setup, change the database settings to sqlite: On cryptowatchers-backend/cryptoWatchers/settings.py, change the DATABASE constant to (just uncomment this one and comment the other):
DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.sqlite3',
         'NAME': BASE_DIR / 'db.sqlite3',
     }
}
  1. Apply the migrations:
python manage.py migrate
  1. Run the server
python manage.py runserver

Api paths:

  • api/token/:
    Path to login a user, fill the POST request body as such:
{
  "username": "{{your username}}",
  "email": "{{your email}}"
}

Returns in the response body:

{"token": "{{your token}}"}
  • api/register/:
    Path to register a user, fill the POST request body as such:
{
  "username": "{{your username}}",
  "email": "{{your email}}",
  "password": "{{your password}}"
}

Returns:

{"token": "{{your token}}"}
  • api/cryptos/: To create a new crypto, POST with the request body as such:
{
  "crypto_id": "{{The crypto id in coincap API}}",
  "buying_price": "{{the price you paid}}",
  "quantity": "{{The quantity bought}}",
  "notes": "{{your notes about the purchase}}"
}

With the authorization header:

{
  "Authorization": "Token {{your token}}"
}

Returns the list of all the cryptos of the user, including the one just posted.
To see the coinCap API id, see their documentation.
To get the list of all user's crypto, make a GET request with the authorization header: With the authorization header:

{
  "Authorization": "Token {{your token}}"
}

Returns a json with all user's crypto.

Releases

No releases published

Packages

No packages published