Name: Camilo Calvo-Alcaniz
Date: April 12th, 2019
Project Topic: Quotes
Data point fields:
Field 1
: NameType: String
Field 2
: BreedType: String
Field 3
: WeightType: Number
Field 4
: AgeType: Number
Field 5
: CharacteristicsType: [String]
Schema:
{
name: String,
breed: String,
weight: Number,
age: Number,
characteristics: [String]
}
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);
});
GET endpoint route: /api/...
Search Field: name
Navigation Filters
- Heavy Dogs ->
/heaviest
- Select a Breed ->
/breed/:breed_name
- Young Dog ->
/youngest
- Random Dog ->
/random
- Alphabetical Dogs ->
/alphabetical