Receiving req.body empty with post form with Express node.js

req.body is made up of names and values.

add name="search" on your search box and try again.

You also must use the express/connect.bodyParser() middleware, thanks Nick Mitchinson!


I had this problem and it turned out I was using app.use(express.bodyParser()); but it was after the code I was using. Moving it up solved the issue.


on express 4 would be this one. (note that this will not parse multipart/uploads).

app.use(bodyParser.urlencoded({extended: true}));

and if you want to receive json input

app.use(bodyParser.json());