Huligan Huligan - 9 months ago 24
Node.js Question

How to transfer params to GET method in Express?

I have the following URL:

'http://localhost/track/' + id + '/fromdate/' + date_start + '/todate/' + date_end

And there is handler in Node.js part:

app.get('/track/:id/fromdate/:fromdate/todate/:todate', function(req, res){

Why I can not get


can you try this please:

'http://localhost/track/' + encodeURIComponent(id) + '/fromdate/' + encodeURIComponent(date_start)+ '/todate/' + encodeURIComponent(date_end)

when you are making a get request, you should turn the parameters into encoded URI components like in the example i give