Bucketlist is an API powered application that helps its users to create bucketlists and add todo items to them.
Backend
- Python 2.7
- Postgres 9.4
- Flask 0.12.2
- Flash Restful 0.3.5
Frontend
- Angular 2
Pre-requisites
- Install Python v2.7.*
- Install virtualenv and/or virtualenvwrapper
- Create a virtual environment and activate it.
- Clone the project from
https://github.com/SProjects/bucketlist_andela.git
cd
into the project root- Create database. Run
createdb bucketlist_dev
in the terminal - Migrate the database using
python manage.py db upgrade
- Run
source go.sh
- Run
init
- After a successful build, run
serve
- Create a virtual environment and activate it.
- Clone the project from
https://github.com/SProjects/bucketlist_andela.git
cd
into the project root- Run
pip install requirements.txt
to install all project dependencies to the virtual environment. - Create database. Run
createdb bucketlist_dev
in the terminal - Migrate the database using
python manage.py db upgrade
cd
into the client directorycd bucketlist/client/
- Install bower components
bower install
- Install npm requirements
npm install
- Build the project
ng build
cd
back to the root directory- Start the application with;
python manage.py runserver
- Using the authentication endpoint get a token which you send in place of the username in the basic authentication parameters.
- OR Use the username(email of user) and password as parameters for basic authentication
Url: http://<base_url>/api/v1/auth/register
Action: POST
Post data:
{
'first_name': 'FirstName',
'last_name': 'LastName',
'email': '[email protected]',
'password': 'good_password',
'password_confirm': 'good_password'
}
Response:
{'message': 'You registered successfully.'}
Authorization: False
Url: http://<base_url>/api/v1/auth/login
Action: POST
Post data:
{
'email': '[email protected]',
'password': 'good_password'
}
Response:
{'token': 'alphanumeric_string'}
Authorization: False
Url: http://<base_url>/api/v1/users
Action: GET
Response:
{
'results': [
{
'first_name': 'FirstName',
'last_name': 'LastName',
'email': '[email protected]',
'password': 'good_password',
'password_confirm': 'good_password'
}
]
}
Authorization: True
Url: http://<base_url>/api/v1/users/<user_id>
Action: GET
Response:
{
'first_name': 'FirstName',
'last_name': 'LastName',
'email': '[email protected]',
'password': 'good_password',
'password_confirm': 'good_password'
}
Authorization: True
Url: http://<base_url>/api/v1/users/<user_id>
Action: PUT
Put data:
{
'first_name': 'updated_first_name',
'last_name': 'updated_last_name',
'email': 'updated_email'
'old_password': 'current_password',
'new_password': 'new_password',
'new_password_confirm': 'new_password'
}
Response:
Updated user object
Authorization: True
Url: http://<base_url>/api/v1/users/<user_id>
Action: DELETE
Response: {'message': 'User with id#<user_id> successfully deleted.'}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists
Action: POST
Post data:
{'name': 'Bucketlist Name'}
Response
{'message': 'Bucketlist created successfully.'}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists
Action: GET
{
'results': [
{
'created_by': 1,
'date_created': 'Tue, 23 May 2017 10:59:06 -0000',
'date_modified': 'Tue, 23 May 2017 12:26:50 -0000',
'id': 1,
'items': [
{
'date_created': 'Tue, 23 May 2017 14:25:13 -0000',
'date_modified': 'Tue, 23 May 2017 14:25:13 -0000',
'done': false,
'id': 1,
'name': 'To do item'
}
],
'name': 'Bucketlist name'
}
]
}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists/<bucketlist_id>
Action: GET
Response:
{
'created_by': 1,
'date_created': 'Tue, 23 May 2017 10:59:06 -0000',
'date_modified': 'Tue, 23 May 2017 12:26:50 -0000',
'id': 1,
'items': [
{
'date_created': 'Tue, 23 May 2017 14:25:13 -0000',
'date_modified': 'Tue, 23 May 2017 14:25:13 -0000',
'done': false,
'id': 1,
'name': 'To do item'
}
],
'name': 'Bucketlist name'
}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists/<bucketlist_id>
Action: PUT
Post data:
{'name': 'Bucketlist Name'}
Response:
Updated bucketlist object
Authorization: True
Url: http://<base_url>/api/v1/bucketlists/<bucketlist_id>
Action: DELETE
Response: {'message': 'Bucketlist with ID#<bucketlist_id> successfully deleted.'
Authorization: True
Url: http://<base_url>/api/v1/bucketlists?q=<search_term>
Action: GET
Response:
{
'results': [
{
'created_by': 1,
'date_created': 'Tue, 23 May 2017 10:59:06 -0000',
'date_modified': 'Tue, 23 May 2017 12:26:50 -0000',
'id': 1,
'items': [
{
'date_created': 'Tue, 23 May 2017 14:25:13 -0000',
'date_modified': 'Tue, 23 May 2017 14:25:13 -0000',
'done': false,
'id': 1,
'name': 'To do item'
}
],
'name': 'Bucketlist name'
}
]
}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists?limit=<page_size>
Action: GET
Response:
{
'results': [
{
'created_by': 1,
'date_created': 'Tue, 23 May 2017 10:59:06 -0000',
'date_modified': 'Tue, 23 May 2017 12:26:50 -0000',
'id': 1,
'items': [
{
'date_created': 'Tue, 23 May 2017 14:25:13 -0000',
'date_modified': 'Tue, 23 May 2017 14:25:13 -0000',
'done': false,
'id': 1,
'name': 'To do item'
}
],
'name': 'Bucketlist name'
}
],
'next': '/api/v1/bucketlists?limit=1&page=1',
'num_results': 2,
'page': 1,
'total_pages': 2
}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists/<bucketlist_id>/items
Action: POST
Post data:
{'name': 'Item Name'}
Response:
{'message': 'Item successfully added to Bucketlist ID#<bucketlist_id>'}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists/<bucketlist_id>/items
Action: GET
Response:
{
'results': [
{
'date_created': 'Tue, 23 May 2017 14:25:13 -0000',
'date_modified': 'Tue, 23 May 2017 14:25:13 -0000',
'done': false,
'id': 1,
'name': 'To do item'
}
]
}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists/<bucketlist_id>/items/<item_id>
Action: GET
Response:
{
'date_created': 'Tue, 23 May 2017 14:25:13 -0000',
'date_modified': 'Tue, 23 May 2017 14:25:13 -0000',
'done': false,
'id': 1,
'name': 'To do item'
}
Authorization: True
Url: http://<base_url>/api/v1/bucketlists/<bucketlist_id>/items/<item_id>
Action: PUT
Data (done can be True for completed or False for incomplete)
{'name': 'Bucketlist Name', 'done': True}
Response:
Updated item object
Authorization: True
Url: http://<base_url>/api/v1/bucketlists/<bucketlist_id>/items/<item_id>
Action: DELETE
Response: {'message': 'Item with ID#<item_id> deleted successfully.'}
Authorization: True
nosetests --rednose
nosetests --rednose --with-coverage --cover-inclusive --cover-package=bucketlist --cover-erase --cover-html