WDI-SEA / project-4-issues

Open an issue to receive help on project 4 issues
0 stars 0 forks source link

Can't retrieve comments from the local database #53

Open JuanR9910 opened 2 years ago

JuanR9910 commented 2 years ago

What stack are you using?

(ex: MERN(mongoose + react), DR(django + react), PEN, etc.)

Postgres, Psql, Node,js

What's the problem you're trying to solve?

Having trouble retrieving comment data from the local database

Post any code you think might be relevant (one fenced block per file)

router.get('/:id', (req, res) => { axios.get(https://rawg.io/api/games/${req.params.id}?key=${process.env.RAWG_API_KEY}) .then(apiRes => { console.log('this is apiRes', apiRes.data) const gameData = apiRes.data }) .then(()=> { db.comment.findAll({ where: {gameId:gameData.id} }) }) .then(dbRes => { console.log(dbRes) console.log("THIS IS OUR CONSOLE LOG", gameData) res.render('review.ejs', {gameData:gameData}) })

  `.catch((error) => {`
    `res.status(400).render('main404')`

}) }) `

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

What is your best guess as to the source of the problem?

What things have you already tried to solve the problem?

timmshinbone commented 2 years ago

What error do you get when you make this api call? share it here as a comment or a screenshot

JuanR9910 commented 2 years ago

No error shows up in the terminal