Open JasonDuquain opened 5 years ago
notes/lessons learned:
The API to pull the country names is here: names.json. This one must be used to include only the countries that the names API supports
In order to use the values returned from the request call inside the ejs file, the res.render statement must be INSIDE the request call. Ex:
request({
url: 'https://raw.githubusercontent.com/thm/uinames/master/uinames.com/api/names.json',
json: true
}, (error, response) => {
let namesArray = response.body; //namesArray would not be available outside the request call
res.render("baby/index", {
namesArray: namesArray
});
});
User Story:
Technical tasks required:
Add Jasmine test case(s).
Research pulling this data from the second API's (https://restcountries.eu) developer documentation.
Write the code with node and express to dynamically add the country names to the HTML option elements on page load.
Confirm all jasmine test specs pass.
Difficulty Rating: 2