[SOLVED]How does Exercise Tracker url params work?

[SOLVED]How does Exercise Tracker url params work?
0

#1

I’m doing the exercise tracker project and I don’t know how to implement this feature:
GET users’s exercise log: GET /api/exercise/log?{userId}[&from][&to][&limit]
Normally with express I could do:
app.get(’/api/exercise/:id’, function(req, res) {
User.find({_id: req.params.id}, function(err, result) {
//code goes here
});
});

But I don’t understand how log?{userId}[&from][&to][&limit] is implemented. Please explain what I’m supposed to do.


#2

You can use the req.query property to extract values from a url that has a query string.

https://expressjs.com/en/api.html#req.query


#3

Thank you for your help.