Zoom
For the DELETE operation, ensure a nation cannot be deleted if any foods are associated with it (i.e., if there are
documents in the food collection referencing the nation's _id). Return an appropriate error message (e.g.,
"Cannot delete nation because it has associated foods") if deletion is attempted in such cases.
Task 03 (4.0 marks). Client application for food management
Student must choose one of template engines (EJS, HANDLEBARS, or PUG) with Express for building the views.
1. Authentication function
At the login view, the route path will match requests to:
http://yourdomain/auth/login. Users must enter their
account name (name) and key (key) correctly (encrypted with bcrypt and stored in the users collection). All CRUD
actions require authentication. Display error messages for failed logins. Store account data in the 'users' collection
from users.json'. Redirect to the foods view after a successful login.
2. After successful login, display a list of all foods (using a card view, not a table view): foodName, rating, calories,
is Vegetarian and including the nation name. The This route path will match requests to
http://yourdomain/page/foods.
3. After successful login, allow deletion of a selected food by confirming the action and notifying the result. This
route path will match requests to
http://yourdomain/page/foods/:id.
4 After successful login add a new food that meets the requirements using a modal form
+ 100%
Close