Nodejs req.params is []

Nodejs req.params is []

Problem

In my Nodejs app,I send a request,but the req.params return []

res.send(req.params);

But I get the Form Data from the chrome:

title:Hello world!
site:http://www.baidu.com
begdt:2013-12-31 02:25
enddt:2014-01-01 10:00
category:lottery
cover:face111.jpg
editorValue:<p>hello world hehe!</p>

Where the error is?

Problem courtesy of: HXH

Solution

See the documentation.
req.params contains matched route parameters only.

POST data is sent in req.body.

Solution courtesy of: SLaks

Discussion

Leave a Reply

Your email address will not be published. Required fields are marked *