This project contains following APIs
api-token-auth
- MakingPOST
request on this api with username and password in request body will get access token that should be used in other APIs withAuthorization
header.api/calculate-three-sum
- It takes a list and a sum in request body with methodPOST
and return all combination of triplets with sum equal to given sumapi/transaction-history
- MakingGET
request on this api will list all previous input and output data of above API.
Project is implemented in Django (Django Rest Framework) and connected with Postgres database.
- Create virtual enviornment by
virtualenv -p python3.6 venv
- Activate it by
source venv/bin/activate
- install requirements by
pip install -r requirements.txt
- Install postgres db, create database, add user and grant all privileges to the user as defined in
assignment/settings.py
- Run
python manage.py migrate
for db migration. - Run development server by
python manage.py runserver
- Create superuser by
python manage.py createsuperuser
- Obtain authentication token by using
api-token-auth
API.