This is the response what I get when I hit the URL,
{"username":"fcc_test_16448402534","count":2,"_id":"620a453d46a4c9f0c5f6df2d","log":[{"description":"test","duration":60,"date":"Mon Jan 01 1990"},{"description":"test","duration":60,"date":"Tue Jan 02 1990"}]}
Cannot wrap my head around whats wrong in there, my api endpoint looks like this:
app.get('/api/users/:_id/logs', function(req, res){
const _id = req.params['_id'];
let responseObject={} ;
Tracker.findById(_id, (err, result)=>{
if(!err && result != undefined){
// console.log('Result: ', result)
responseObject['username'] = result.username;
responseObject['count'] = result.log.length;
responseObject['_id'] = result._id;
responseObject['log'] = result.log;
}
// console.log('Response: ', responseObject);
res.json(responseObject)
})
});
Describe your issue in detail here.
Your project link(s)
solution: https://replit.com/@mi8guy/boilerplate-project-exercisetracker
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Challenge: Exercise Tracker
Link to the challenge: