Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Open NPM in the directory you created for Task 1 2. Create two new files in the views folder, one called foodlist.pug and the
1. Open NPM in the directory you created for Task 1 2. Create two new files in the views folder, one called foodlist.pug and the other called favourite- food.pug 3. Copy all the code from index.pug into both files 4. Modify foodlist.pug so it contains a paragraph which says: "Here is a list of my favourite foods" instead of the "Welcome" message 5. Modify favourite-food.pug so it contains a paragraph which says: "Here is my favourite food" instead of the "Welcome" message 6. Create a new file in the controller folder called food.js 7. Create two functions using the same code as the index function in main.js, name one foodlist and name the other favourite Food 8. Change the title of foodlist so it says Food list and change the title of favourite Food so it says "My favourite food" 9. Change the foodlist template from 'index' to'foodlist' and change the favourite Food template from 'index' to'favorite-food' 10. Open the index.js file in the routes folder and add a new const called ctrlFood which references the food.js controller 11. Update the routes so that if the user goes to /favourite it calls ctrlFood.favourite Food and if the usergoes to /listit calls ctrlFood.foodlist 12. Run the server with npm start and show the result to your professor
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started