node.js - console output req.params in node/express -


when do:

console.log(req.params), outputs:

[ id: "param1" ] 

however when do, console.log("params:[%s]", req.params),it outputs

[[]] 

i tried

 console.log("params:[%j]", req.params),  console.log("params:[%s]", json.stringify(req.params)),   console.log("params:" + req.params), 

with output not expected.

what wrong here?`

try require('util').inspect() method formatting. format calling method changed in 0.10.0, depending on version of node in have use different node doc.

here links pre , post 0.10.0 version of function.

http://nodejs.org/docs/v0.8.25/api/util.html#util_util_inspect_object_showhidden_depth_colors http://nodejs.org/docs/v0.10.13/api/util.html#util_util_inspect_object_options

so, like:

console.log( require('util').inspect( req.params ) ); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -