Git Product home page Git Product logo

wishlists's Introduction

NYU DevOps Project - Wishlists

Development Site : http://159.122.178.201:31001/ Production Site : http://159.122.178.201:31002/

Build Status codecov BDD Tests

License Python

Overview

Following is the project setup for the Wishlists functionality of a demo e-commerce website. It allows for creation of multiple wishlists for each customer and multiple items with fields like rank, quantity, price for various functionality. The service supports all CRUD: create, read, update, delete, list and find by query operations on the main schemas of Wishlist and Items which correspond to the Items list in a wishlist.

Available REST API's

Route Operation Description
/healthcheck Service Healthcheck
/ root index Root URL returns service name
POST /wishlists CREATE Create new Wishlist
GET /wishlists/<wishlist_id> READ Show a single wishlist
POST /wishlists/<wishlist_id>/items CREATE Add item in body to wishlist
GET /wishlists/<wishlist_id>/items/<item_id> READ Show a given item in wishlist
DELETE /wishlists/<wishlist_id> DELETE Delete given Wishlist
DELETE /wishlists/<wishlist_id>/items/<item_id> DELETE Delete item from Wishlist
PUT /wishlists/<id> UPDATE Rename wishlist
GET /wishlists/<id>/items READ List items in wishlist [ordered by rank field]
GET /wishlists LIST Show all wishlists
GET /wishlists?q=querytext QUERY Search for a wishlist
GET /wishlists/<id>?q=querytext QUERY Search for items in wishlist

Running the service

Given that you have cloned the repository. Using the below command in the repo folder:

$ code .

opens the repo in VSCode, where you need to select the option to Reopen in Containers which brings up the wishlist:app and postgres images.

The project uses honcho which gets it's commands from the Procfile. To start the service simply use:

$ honcho start

You should be able to reach the service at: http://localhost:8000. The port that is used is controlled by an environment variable defined in the .flaskenv file which Flask uses to load it's configuration from the environment by default. Going to the above URL localhost:8000, you will see a message about the service which looks something like this:

{
  "name": "Wishlists Demo REST API Service", 
  "paths": "http://localhost:8000/wishlists", 
  "version": "1.0"
}

which is the response from the root index. Other API routes can be hit as detailed from the Available REST API's tab which can be hit using POSTMAN or curl commands from terminal the POST API required a body of Wishlist or Items for creating them which looks like:

Wishlist model

{   "id": Int,
    "name": String,
    "customer_id": Int,
    "created_on": DateTime} 

Items model

{   "id": Int,
    "name": String,
    "wishlist_id": Int,
    "product_id": Int,
    "created_on": DateTime,
    "rank": Int,
    "price": Int,
    "quantity": Int,
    "updated_on": DateTime} 

Testing

The testing files are all present in app/tests folder. You can run the tests using:

nosetests

You will see all the tests passsing with the code coverage at the end. setup.cfg file controls test results level of detail like verbosity.

Contents

The project contains the following:

.gitignore          - this will ignore .devcontainer and other metadata files
.flaskenv           - Environment variables to configure Flask
.gitattributes      - File to gix Windows CRLF issues
.devcontainers/     - Folder with support for VSCode Remote Containers
dot-env-example     - copy to .env to use environment variables
requirements.txt    - list if Python libraries required by your code
config.py           - configuration parameters

service/                   - service python package
├── __init__.py            - package initializer
├── models.py              - module with business models
├── routes.py              - module with service routes
└── common                 - common code package
    ├── error_handlers.py  - HTTP error handling code
    ├── log_handlers.py    - logging setup code
    └── status.py          - HTTP status constants

tests/              - test cases package
├── __init__.py     - package initializer
├── test_wishlists_models.py  - test suite for Wishlist model
├── test_item_models.py  - test suite for Items model
└── test_routes.py  - test suite for service routes

License

Copyright (c) John Rofrano. All rights reserved.

Licensed under the Apache License. See LICENSE

This repository is part of the NYU masters class: CSCI-GA.2820-001 DevOps and Agile Methodologies created and taught by John Rofrano, Adjunct Instructor, NYU Courant Institute, Graduate Division, Computer Science, and NYU Stern School of Business.

wishlists's People

Contributors

chan-kh avatar csatti97 avatar gabeorlanski avatar jaikar-moengage avatar jaikarnyu avatar rajan0115 avatar sarvanin 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.