Giter Club home page Giter Club logo

phase-3-mock-code-challenge-spicemaster's Introduction

Phase 3 Mock Code Challenge: SpiceMaster

Today you'll be building an app for creating spice blend recipes. You will be using a local API and building out the frontend for our app.

Demo

Use this gif as an example of how the core deliverables for the app should work.

demo

Setup

  • Run json-server --watch db.json --routes routes.json to get the backend started
  • Open the index.html file on your browser
  • Write your code in the index.js file

API Endpoints

Your base URL for your API will be: http://localhost:3000

The endpoints you will need for the core deliverables are:

GET /spiceblends/1

# Example Response
{
    "id": 1,
    "title": "Pumpkin Spice",
    "image": "./assets/spices/pumpkinspicelatte.jpg",
    "ingredients": [
        {
            "id": 1,
            "name": "Cinnamon",
            "spiceblendId": 1
        },
        {
            "id": 2,
            "name": "Nutmeg",
            "spiceblendId": 1
        }
    ]
}
PATCH /spiceblends/1

# Required Headers
{ 
  "Content-Type": "application/json"
}

# Required Body
{ 
  title: "updated title"
}

# Example Response
{
  "id": 1,
  "title": "updated title",
  "image": "./assets/spices/pumpkinspicelatte.jpg"
}

Core Deliverables

As a user, I can:

  • See the first spice blend (the spice blend with an ID of 1), including its title, image, and list of ingredients, when the page loads.
  • Update the title of the spice blend on the page when the #update-form is submitted, and still see that change when reloading the page (the new title should be persisted on the server).
  • Add a new ingredient to the spice blend when the #ingredient-form is submitted. The new ingredient should be displayed on the page (no persistence needed for now).

Advanced Deliverables

These deliverables are not required to pass the code challenge, but if you have the extra time, or even after the code challenge, they are a great way to stretch your skills.

Note: If you are going to attempt these advanced deliverables, please be sure to have a working commit with all the Core Deliverables first!

Here is a demo of the advanced deliverables:

demo-advanced

You'll need a these endpoints for the advanced deliverables:

POST /ingredients

# Required Headers
{ 
  "Content-Type": "application/json"
}

# Required Body
{ 
  name: "ingredient name",
  spiceblendId: 1
}

# Example Response
{
  "name": "ingredient name",
  "spiceblendId": 1,
  "id": 17
}
GET /spiceblends

# Example Response
[
  {
    "id": 1,
    "title": "Pumpkin Spice",
    "image": "./assets/spices/pumpkinspicelatte.jpg"
  },
  {
    "id": 2,
    "title": "Za'atar",
    "image": "./assets/spices/zaatar.jpg"
  }
]
GET /spiceblends/:id

# Example Response
{
  "id": 1,
  "title": "Pumpkin Spice",
  "image": "./assets/spices/pumpkinspicelatte.jpg",
  "ingredients": [
    {
      "id": 1,
      "name": "Cinnamon",
      "spiceblendId": 1
    },
    {
      "id": 2,
      "name": "Nutmeg",
      "spiceblendId": 1
    }
  ]
}

As a user, I can:

  • Persist new ingredients to the server when the #ingredient-form is submitted. Make sure to follow the format listed above to make a POST request to /ingredients. In the body of the request, the spiceblendId will need to be a number (not a string).
  • See all spice blend images in the #spice-images div when the page loads. Request the data from the server to get all the spice blends. Then, display the image for each of the spice blends using an img tag inside the #spice-images div.
  • Click on an image from the #spice-images div and see all the info about that spice blend displayed inside the #spice-blend-detail div. You will need to make another GET request with the spice blend's ID to get the information about the spice blend that was clicked.

Rubric

You can find the rubric for this assessment here.

phase-3-mock-code-challenge-spicemaster's People

Contributors

ihollander 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.