Git Product home page Git Product logo

phase-3-challenge-b's Introduction

phase-3-challenge-b

part-1

GET and POST routes

While in the part-1 directory:

Install dependencies with npm install

Start the server with npm start

GET Route:

GET a number that corresponds with a day of the week, where Monday is 1, and Sunday is 7 at this route: localhost:3000/api/days/:day

Example:

localhost:3000/api/days/wednesday responds with 3

POST Route:

POST a JSON object of arrays at localhost:3000/api/array/concat with Postman or curl and get a concatenation of those two arrays back.

Example: curl -i -d '{"array1": [3, 4], "array2": [5, 6]}' -H "Content-Type: application/json" localhost:3000/api/array/concat

the response is: {"result":[3,4,5,6]

If either array1 or array2 are not an array, the response is:

{"error":"Input data should be type of array."}

part-2

Command Line Grocery Store

While in the part-2 directory:

Install dependencies with npm install

Create the database with npm start

In the load-data.sql file, add the full path to groceries.csv to the COPY statement and in the command line use npm run-script run to load the seed data into the database.

Make queries through the command line:

List all products from a section

node ./store product-list <section-name>

Example:

node ./store product-list bulk will display:

name                      section
---------------------------------
Flour              bulk
Pasta              bulk
Rice              bulk

List all orders for a given shopper id, returns all of that shopper's order ids, and the total cost of each order

node ./store shopper-orders <shopper-id>

Example:

node ./store shopper-orders 1 will display:

order id    total cost
----------------------
1           15.50
3           16.61

List all the shoppers that have at least 1 order, and also display the number of orders for them.

node ./store real-shoppers will display:

shopper            num. of orders
---------------------------------
Tom Solomon         1
Harry Solomon         2
Rhonda Smith         2

npm test runs tests on test versions of the functions these commands use, but they need some refactoring.

part-3

Web Interface for Grocery Store

This directory contains an html file and related CSS and JS files for a front-end grocery store page that can be opened in the browser.

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.