Professional Documents
Culture Documents
Task 81
Task 81
1. Open NPM in the directory you have been using for the previous tasks
2. Open app_server/controllers/food.js
3. Remove the old code, except for the exports at the bottom
4. Install 'request' into your application by running npm install --save request
5. Add the const request = require('request'); to the top of food.js.
6. On the second line, create the apiOptions constant like this:
const apiOptions = {
server: 'http://localhost:3000'
};
7. Modify the module.exports so the favouriteFood is now foodInfo
8. Add the following code snippets to create functionality to display a list from the database:
9. Add the following code snippet to create the rendering of the home page:
10. Add the following code snippets to create functionality to display a single item: