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

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -