Skip to content

Latest commit

 

History

History
82 lines (60 loc) · 1.52 KB

documentation_example.md

File metadata and controls

82 lines (60 loc) · 1.52 KB

Quotes for the Dreamer in You


Name: Camilo Calvo-Alcaniz

Date: April 12th, 2019

Project Topic: Quotes

1. Data Format and Storage

Data point fields:

  • Field 1: Name Type: String
  • Field 2: Breed Type: String
  • Field 3: Weight Type: Number
  • Field 4: Age Type: Number
  • Field 5: Characteristics Type: [String]

Schema:

{
    name: String,
    breed: String,
    weight: Number, 
    age: Number,
    characteristics: [String]
}

2. Add New Data

HTML form route: /addDog

POST endpoint route: /api/addDog

Example Node.js POST request to endpoint:

var request = require("request");

var options = { 
    method: 'POST',
    url: 'http://localhost:3000/api/addDog',
    headers: { 
        'content-type': 'application/x-www-form-urlencoded' 
    },
    form: { 
        name: 'Cupcake', 
        breed: 'German Shepherd',
        image: "http://i.imgur.com/iGLcfkN.jpg",
        age: 6
        characteristics: ["Brown", "Black", "Sleepy", "Lazy"]
    } 
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

3. View Data

GET endpoint route: /api/...

4. Search Data

Search Field: name

5. Navigation Pages

Navigation Filters

  1. Heavy Dogs -> /heaviest
  2. Select a Breed -> /breed/:breed_name
  3. Young Dog -> /youngest
  4. Random Dog -> /random
  5. Alphabetical Dogs -> /alphabetical