Giter VIP home page Giter VIP logo

checkpoint-2's Introduction

Build Status Coverage Status Codacy Badge CircleCI

BUCKETLIST API APPLICATION

Bucketlists is a RESTful API application where users can create bucketlists with multiple items. The application uses Token Based Authentication for user authentication and authorization.

Application Description

Dependencies

The Bucketlist API is a python/flask_RESTful application and is mainly dependent on the following technologies

Functionality

The user of the application has the ability to carry out the following

  • Register a new user with the application

    • Usernames have to be unique for a successful registration
    • Users must provide a password for a successful registration
    • Usernames and passwords must be minimum 4 characters for successful registration
        {
            "username": "sample_username",
            "password": "sample_password"
        }
    
  • Login to use the system with the same information above

  • Once logged in, the user then requests for token

    • Each token is valid for 30 minutes after which it is invalid
    • Once logged in, a user can request another token, without having to log back in
  • Users can create new bucketlists each with a unique name with the POST information below

        {
            "name": "sample_bucketlist"
        }
    
  • For each bucketlist, a user can add an items with a similar post

  • Items and bucketlists can be deleted from the server

    • Deleting a bucketlist deletes all its items
  • Bucketlist names can be updated and Items' done statuses can also be updated

  • A user can request for all their bucketlists in the system, or a specific bucketlist

  • Users can only interact with bucketlists that they created

API endpoints and Routes

ENDPOINT FUNCTIONALITY
POST /auth/login Logs a user in
POST /auth/register Register 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 this bucket list
DELETE /bucketlists/<id> Delete this single bucket list
POST /bucketlists/<id>/items/ Create a new item in bucket list
PUT /bucketlists/<id>/items/<item_id> Update a bucketlist item
DELETE /bucketlists/<id>/items/<item_id> Delete an item in a bucket list

Installation

The bucketlist API is a flask and Python3 application and it is advisable to install it in a virtual environment. As most Linux machines come with Python 2 installed, it is required that you install Python 3 through the terminal using the commands

$ sudo apt-get update 
$ sudo apt-get install python3 

If you are using macOS, python3 can be installed through the terminal using the command

$ brew install python3

If you do not already have git installed on your system install it as well

$ sudo apt-get install git

or on macOS

$ brew install git

Python3 comes with a package manager called pip, which enables you to install different packages in your environment We shall use pip to install virtualenv, which helps us create a virtual environment where dependencies can be installed without impacting the rest of the system To install virtualenv run the following command

$ pip install virtualenv

Once installed, create a directory for the application called Bucketlist and open it using the commands

$ mkdir Bucketlist
$ cd Bucketlist

Create a virtual environment for the application that is python3 specific

$ virtualenv -p python3 venv-bucketlist

Activate the virtual environment

$ source venv-bucketlist/bin/activate 

At this point, clone the project into the folder, move into the project directory and run the requirements file

$ git clone https://github.com/andela-sgaamuwa/Checkpoint-2.git
$ cd Checkpoint-2
$ pip install -r requirements.txt

The application is then ready to run, simply use the command

$ python manage.py runserver

Running tests

Upon installation it is advisable to run the tests to ensure that the application is running as it should and nothing is broken In the root directory of the application, via the terminal, run the command

$ nosetests --with-coverage --cover-package=app

A successful test should produce the following results

(cp2-venv) Samuels-MacBook-Pro:bucketlist gaamuwa$ nosetests --with-coverage --cover-package=app
.....................
Name                    Stmts   Miss  Cover
-------------------------------------------
app.py                      0      0   100%
app/app.py                  7      0   100%
app/authentication.py      46      3    93%
app/bucketlist.py         127      0   100%
app/models.py              40      0   100%
app/resource.py           116      1    99%
-------------------------------------------
TOTAL                     336      4    99%
----------------------------------------------------------------------
Ran 21 tests in 3.364s

checkpoint-2's People

Contributors

sgaamuwa avatar

Stargazers

Indrajith Bandara avatar Eugene Duboviy avatar

Watchers

Shem Ogumbe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.