id captured in the request capturing the name of scripts files

Asked

Viewed 7 times

0

The part of the route where the error is happening is this, the beginning of the controller is described like this

module.exports.showOneCampground = async (req, res)=>{
    const { id } = req.params;
    const campgroundSelected = await Campground.findById(id).populate({...

The value of req.params this carrying in the const id not only the value of id that I will search in the database but also the value of the name of two js files of another folder that serves only to assist in the style of the form and because of that generates error in the database why it locates the id recorded and then tries to locate the file name by generating error.

This is the print of the request.

{ id: '5fde421c17d3e20a60bd6d1b' }
{ id: 'showMap.js' }

What I’d like to know is if this is normal, or if I referenced it in some way wrong or if there’s a better way to get the id of the requisition.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.