Code Monkey home page Code Monkey logo

wishlists's Introduction

wishlists

Build Status codecov

Wishlists RESTful service allows customers to create a collection of products that they wish they had the money to purchase.

Team: Hu Jianyuan, Omer Katz, Sakada Lim, Minh Lai, Doyeon Kong

Prerequisite Installation using Vagrant

The easiest way to use this lab is with Vagrant and VirtualBox. if you don't have this software the first step is down download and install it.

Download VirtualBox

Download Vagrant

Clone the project to your development folder and create your Vagrant vm

    git clone https://github.com/NYU-Wishlists/wishlists.git
    cd wishlists
    vagrant up

Once the VM is up you can use it with:

    vagrant ssh
    cd /vagrant
    python run.py

Alternatively you can also start by using honcho

    vagrant ssh
    cd /vagrant
    honcho start

Honcho makes use of the Procfile to start the service using Gunicorn similar to how one would start the server in production.

You should now be able to see the service running in your browser by going to http://localhost:5000. You will see a message about the service which looks something like this:

{
    name: "Wishlist Demo REST API Service",
    url: "http://localhost:5000/wishlists",
    version: "1.0"
}

When you are done, you can use Ctrl+C within the VM to stop the server.

Testing

Run the test using behave

    cd /vagrant
    python run.py &
    behave

Note that the & runs the server in the background. To stop the server, you must bring it to the foreground and then press Ctrl+C

Stop the server with

    fg
    <ctrl+c>

This repo also has a unit test that you can run with

    cd /vagrant
    nosetests

You should see all of the tests passing with a code coverage report at the end. This is controlled by the setup.cfg file in the repo.

Services

  • HealthCheck Check that the api is up and running.

    GET /healthcheck
    
  • Create a wishlist

    POST /wishlists
    

    Body example/format

    {
    "user": "Mikey", 
    "entries": 
      [{"id": 0, "name": "Mackbook"}, 
       {"id": 1, "name": " Iphone"}], 
    "name": "Mikes"
    }
    
  • Retrieve all wishlists

    GET /wishlists
    
    GET /
    

With a specific wishlist ID, you can perform the following action:

  • Read a wishlist with id, list all items in it

    GET /wishlists/<int:wishtlist_id>
    
  • Update a wishlist with id

    PUT /wishlists/<int:wishlist_id>
    
  • Delete a wishlist with id

    DELETE /wishlists/<int:id>
    

Other actions that can be performed:

  • Query with username, list all wishlists of a user

    GET /wishlists?wishlist_user=username
    
  • Action delete all wishlists of a user

    DELETE /wishlists/<string:user_name>/delete_all
    

Shutdown

When you are done, you can use the exit command to get out of the virtual machine just as if it were a remote server and shut down the vm with the following:

    exit
    vagrant halt

If the VM is no longer needed you can remove it with from your computer to free up disk space with:

    vagrant destroy

wishlists's People

Contributors

minhlai avatar jiayuanhu avatar sakadalim avatar okatz18 avatar okatzz avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.