const app = express()
app.use(bodyParser())
router.get('/edaman', (req, res) => {
console.log(req.body)
axios.get(edamanUrl)
.then(function (response) {
const recipes = response.data.hits
return res.status(200).json({ body: recipes })
})
})
I am encountering an issue while trying to access the keys within the recipe object in the body. Despite using console.log(req.body), I am unable to retrieve the desired results by attempting req.body.recipe—resulting in 'undefined'. There seems to be a clear and simple solution that I am overlooking here. Thank you for your help.
{ '{\n "recipe": {\n "ingredient": "chicken"\n }\n }': '' }