listed as part of app.js, not src/index.js. At least, that's what worked for me.
Also, eslint was throwing an error for me, telling me to use '===' instead of '==' in the various filter/map/indexOf functions. So I used '===' and then changed pulling my IDs from req.params to:
const id = parseInt(req.params.id)
Is there a better way to cast the id constant to an int while still using object destructuring, so I can use strict equality while still keeping the nice format you used?
Thanks for the feedback!
Yes you are right, I wrote src\index.js instead of src\app.js.
About parsing on Object destructuring I don't think it's possible but your solution works great. I didn't focus too much on validations for now since I'm going to come back to the routes when I finish the database module. Anyway you are right, you should use '===' whenever you can.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Filipe,
Nice tutorial! I have two questions/suggestions.
I believe you should have the code for
listed as part of app.js, not src/index.js. At least, that's what worked for me.
Also, eslint was throwing an error for me, telling me to use '===' instead of '==' in the various filter/map/indexOf functions. So I used '===' and then changed pulling my IDs from req.params to:
const id = parseInt(req.params.id)
Is there a better way to cast the id constant to an int while still using object destructuring, so I can use strict equality while still keeping the nice format you used?
Thanks for the feedback!
Yes you are right, I wrote
src\index.js
instead ofsrc\app.js
.About parsing on Object destructuring I don't think it's possible but your solution works great. I didn't focus too much on validations for now since I'm going to come back to the routes when I finish the database module. Anyway you are right, you should use '===' whenever you can.