Coder Social home page Coder Social logo

dggjsc / products Goto Github PK

View Code? Open in Web Editor NEW

This project forked from products-development-team/products

0.0 0.0 0.0 155 KB

The products resource represents the store items that the customer can buy. They could be categorized but they don’t have to be for this assignment. They should have a unique id (perhaps a SKU - Stock Keeping Unit), a name, description, price, and others attributes like perhaps an image.

License: Apache License 2.0

Shell 2.19% Python 87.81% Makefile 3.06% HTML 4.82% Dockerfile 2.05% Procfile 0.07%

products's Introduction

NYU DevOps Project-- Product Team

License Build Status Python

This is an NYU DevOps project that creates a RESTful microservice using Python Flask and PostgreSQL.

Prerequisite Software Installation

This project uses Docker and VS Code with the Remote Containers extension to provide a consistent repeatable disposable development environment.

You will need the following software installed:

  • Docker Desktop
  • VS Code
  • Remote Containers extension from the VS Code Marketplace

Bring up development environment

To bring up the development environment you should clone this repo, change into the repo directory, and then open Visual Studio Code using the code . command. VS Code will prompt you to reopen in a container and you should select it. This will take a while the first time as it builds the Docker image and creates a container from it to develop in.

git clone [email protected]:Products-Development-Team/products.git
cd products
code .

Running the tests

You can run the tests in a bash terminal using the following command:

make test

This will run the test suite and report the code coverage.

Check PEP8 Standard

We've included flake8, Pylint and Black in the requirements.txt, you can check if the code is compliant using the following command:

make lint

Run the REST service

To run the service, use the same bash terminal that you ran the tests in and use

honcho start

(Press CTRL+C to exit). You should be able to open a web page in a local browser at: http://localhost:8000

Make REST calls

While the service is running, you can open a second bash terminal and issue the following commands:

List all resources (Root URL):

http GET http://localhost:8000/

List all products:

http GET http://localhost:8000/products

Create a product:

http POST localhost:8000/products name="" description="" category="" price:=<float> available:=<bool> rating:=<int>

You must specifiy the name, description, category, price and ratingof the product.

  • Acceptable price is within range: 10.0-100.0
  • Acceptable rating is between 0-5

Read a product:

http GET localhost:8000/products/<int:product_id>

Update a product:

http PUT localhost:8000/products/<int:product_id>

Delete a product:

http DELETE localhost:8000/products/<int:product_id>

What's featured in the project?

  • app/routes.py -- the main Service routes using Python Flask
  • app/models.py -- the data model using SQLAlchemy
  • tests/test_routes.py -- test cases against the Product service
  • tests/test_models.py -- test cases against the Product model

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.

products's People

Contributors

yuluqinn avatar dd3053 avatar mpourostad avatar hxwang-463 avatar dggjsc 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.