Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homework Feedback - Node Week 2 #3

Open
jawkha opened this issue Sep 21, 2019 · 0 comments
Open

Homework Feedback - Node Week 2 #3

jawkha opened this issue Sep 21, 2019 · 0 comments

Comments

@jawkha
Copy link

jawkha commented Sep 21, 2019

Warmup Exercise

Please do not upload node_modules to your GitHub repo.

app.get("/numbers/multiply",function(req,res){

You were supposed to use req.params to implement this route.

Meal Sharing Website

Incomplete Requirements for Week 2
Most of the work here is for the requirements identified for Week 1's homework. For this week's work, you have only tried to implement the requirements for /meals and /meals/{id} routes.
The following routes are not implemented:

  • /reservations/{id}
  • /reviews
  • /reviews/{id}

Also, none of the logic you have implemented for the various query params on /meals route is reachable. Can you figure out what the problem is?

Unnecessary fs module in package.json
The fs module that you use in your homework in

is the core file system module in Node which does not need to be installed as a separate package in your package.json. You can read more about the fs module in Node documentation here: https://nodejs.org/api/fs.html

The package with the same name that you have installed here

is an empty placeholder package. You can safely remove it from your homework using npm uninstall fs.

Inconsistencies in files in data directory
In the meals.json file, the price of the first item is of the type number but all other prices are string values. Also, except for the first item, the createdAt property for all objects displays a SyntaxError instead of a useful value.
In the reservations.json file, all the email strings have spaces which would render them invalid.
Although these are not causing any problems in your homework, it's good to review the data that you use.

Implementation of Route /meal
The requirements for this route (for Week 1) were to Respond with the json for a random meal. If the meal has a reservation that matches its id, then add the email of that reservation to the json.

const result = checkReservation(randomMeal).map(reservation => {

Although there's nothing wrong per se with the way you have implemented it, perhaps there's a more compact way to presenting this data. In case of meals for which multiple reservations are available, when one of them is selected as a random meal, the result in the browser looks like multiple meal objects are being sent, even though it's the same meal in each object and the only different property is the reservation email. Instead of creating multiple meal objects for each matching reservation, if all the matching reservations or the associated emails are stored as an array in a separate property on the meal object, it would probably be easier for the user to interpret the data. An example of this implementation would be something like this:

{
  "id": 10,
  "title": "kabab",
  "maxNumberOfGuests": 19,
  "description": "Amet ut voluptate ex consectetur proident. Magna proident eiusmod laborum do cupidatat dolor quis in quis in mollit esse officia. Qui aliqua pariatur laborum laborum non ut amet est eiusmod pariatur nulla ipsum dolore sint. Aliquip ullamco do mollit exercitation deserunt aliquip excepteur exercitation anim ex anim elit proident. Exercitation aliquip consectetur eiusmod ipsum id est dolore eu commodo occaecat ad excepteur id.",
  "createdAt": "<SyntaxError: Unexpected identifier>",
  "price": "100.67",
  "mealReservations": [
    {
      "name": "Barry Whitaker",
      "email": "barry [email protected]",
      "mealId": 10
    },
    {
      "name": "Cooke Hancock",
      "email": "cooke [email protected]",
      "mealId": 10
    },
    {
      "name": "Everett Christensen",
      "email": "everett [email protected]",
      "mealId": 10
    },
    {
      "name": "Lowe Albert",
      "email": "lowe [email protected]",
      "mealId": 10
    }
  ]
}

Conclusion
Please implement the missing routes and debug the other problems highlighted above. If you need help with anything, please ask in the Slack channel for your class or let me know directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant