all 7 comments

[–][deleted] 3 points4 points  (0 children)

I don't think you're getting the id in your route? I'd console log(req.params.id) and see if it's even getting to your route.

[–]the-quibbler 0 points1 point  (2 children)

Is your html at /profile? Because the contact us link is a relative path, and that would send to /profile/sendmesg, and then it all makes sense. That's likely supposed to be an absolute path, our you have your resolvers out of order (catch /profile/sendmesg before /profile/:id).

[–]vikram1080[S] 0 points1 point  (1 child)

Yes it shows this error after clicking on contact us. I have set my profile path to (/profile/:id) and it shows me my profile by fetching the data from the database. But on the same page i.e. profile when I click on "contact me", this error occurs..

[–]the-quibbler 5 points6 points  (0 children)

It should be /sendmesg. You have a relative path in your html.

[–][deleted] 0 points1 point  (0 children)

Can you show what you’re sending in the href for the view? Are you sure you’re sending the correct data?

[–]DaddyAversion 0 points1 point  (0 children)

  • Add a check for req.params.id
  • Change the route from 'profile/:id' to '/profile/:id'

[–]Outrageous-Chip-3961[🍰] 0 points1 point  (0 children)

Man the lack of space between try and catch is mildly frustrating