javascript - Accessing JSON request parameters in Sails -
javascript - Accessing JSON request parameters in Sails -
in controllers , other areas there's req object, can access request parameters using req.params('username'). fine posted data, want api take json object in request body , convert parameters can still access req.params().
so example, if send post request body controller action:
{'username': 'chris', 'password': 'mypass'} i want able username , password using req.params('username') , req.param('password').
at moment thing works sending info this:
username=chris&password=mypass any ideas?
turns out have send request body application/json rather default.
javascript json node.js sails.js
Comments
Post a Comment