Skip to content

ladeoshodi/bucket-list-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Bucket-List-API Coverage Status

Challenge

Design a bucketlist API with flask

Getting Started

Structure of the project

The project is structured using flask blueprint

|-bucket-list-api   
    |-bucket-list-api
        |-app/
            |-api_1/
                |-__init__.py
                |-authentication.py
                |-errors.py
                |-views.py
            |-__init__.py
            |-models.py
        |-tests/
            |-__init__.py
            |-test_api.py
        |-config.py
        |-manage.py
|-.gitignore
|-README.md
|-requirements.txt

Installation

  1. Clone the repository into a Virtual Environment. Run virtualenv <virtualenvname> to create the virtual environment.
  2. Install all the necessary requirements by running pip install -r requirements.txt within the virtual environment.
  3. Configure your configurations in a config.py and save in the same level as manage.py
  4. Run python manage.py migrate and python manage.py upgrade to create the user tables and everything required to run the application.
  5. Run python manage.py runserver to run the app.
  6. Run coverage coverage run manage.py test.
  7. View the report of the coverage on your terminal coverage report.
  8. Produce the html of coverage result coverage html.
  9. Additionally you can run python manage.py -h to get more available options

###Example Requests

$ curl -u lade: password -i http: //localhost:5000/api/v1/bucketlists/
HTTP/1. 0 200 OK
Content-Type: application/json
Content-Length: 316
Server: Werkzeug/0. 8. 3 Python/2. 7. 3
Date: Mon, 20 May 2013 06: 46: 45 GMT
{
  "bucketlists": [
    {
      "bucketlist_url": "http://127.0.0.1:5000/api/v1/bucketlists/1/", 
      "created_by": "lade", 
      "date_created": "Sat, 24 Oct 2015 16:17:25 GMT", 
      "id": 1, 
      "items": [
        {
          "date_created": "Sat, 24 Oct 2015 16:43:57 GMT", 
          "done": false, 
          "id": 1, 
          "last_modified": "Sat, 24 Oct 2015 21:19:50 GMT", 
          "name": "item 1"
        }
      ], 
      "last_modified": "Sat, 24 Oct 2015 16:17:25 GMT", 
      "name": "lade made a bucketlist 1"
    }
  ]
}

Available Endpoints

All requests are json

Endpoint Description
POST /auth/login Logs a user in and returns a token to the user
POST /auth/logout Logs a user out
POST /auth/register Registers a user
POST /bucketlists/ Create a new bucket list
GET /bucketlists/ List all the created bucket lists
GET /bucketlists/<id> Get single bucket list
PUT /bucketlists/<id> Update single bucket list
DELETE /bucketlists/<id> Delete single bucket list
POST /bucketlists/<id>/items Create a new item in bucket list
PUT /bucketlists/<id>/items/<item_id> Update a bucket list item
DELETE /bucketlists/<id>/items/<item_id> Delete an item in a bucket list
GET /bucketlists?limit=20 Returns 20 available bucketlists
GET /bucketlists?q=bucket1 Search for a bucket lists with bucket1 in their name

About

Bucket List API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published