-1

I'm wondering how to get an array that contains all parameters sent in a HTTP request.

If I read the doc: http://expressjs.com/4x/api.html#req.params

I can see that using req.params and req.query, params will be linked to the route parameters and query to the GET parameters. But how can I log the post parameters? The req.param() method requires an argument and doesn't returns an array if I don't provide one. Since all POST parameters must be used through req.param(), there is no way to log them for now. Or am I missing something?

My goal is to efficiently log all parameters to debug easily the application during development, let me know if you have a better way.

Vadorequest
  • 16,593
  • 24
  • 118
  • 215
  • Yes, it is a duplicate, but the title of the other topic doesn't have `express` keyword or in its title so I couldn't find it before, not my fault if it's badly indexed. There is no need to downvote my question which is actually much better indexed. What shold we do? Edit the other topic and add express keyword? That's not a problem to close my topic, I just voted for. I'll edit the other one. – Vadorequest May 16 '14 at 23:16

1 Answers1

4

You're looking for req.body, which contains the parsed POST body. (assuming you have middleware that parses it)

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964