Reputation: 21420
I'm currently writing a web-app in Express, and I was hoping to make use of request.param
to extract parameters that may arrive either in the URL string (for GET
) or in the request body (for POST).
I've passed the request object to a function which, among other things, performs a req.param('email');
However, this snippet throws the following error:
TypeError: Object #<ServerResponse> has no method 'param'
at read_url_params (/home/louist/Documents/node/socialube/modules/user_verif.js:50:63)
at /home/louist/Documents/node/socialube/modules/user_verif.js:43:20
at Promise.<anonymous> (/home/louist/Documents/node/socialube/modules/user_verif.js:73:13)
at Promise.<anonymous> (/home/louist/Documents/node/socialube/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.emit (events.js:95:17)
at Promise.emit (/home/louist/Documents/node/socialube/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/home/louist/Documents/node/socialube/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at /home/louist/Documents/node/socialube/node_modules/mongoose/lib/query.js:1394:13
at model.Document.init (/home/louist/Documents/node/socialube/node_modules/mongoose/lib/document.js:250:11)
at completeOne (/home/louist/Documents/node/socialube/node_modules/mongoose/lib/query.js:1392:10)
I've tried including the bodyParser middleware, but to no avail.
How can I fix this?
Upvotes: 0
Views: 162