http - Using Postman to test my node.js program -
i'm using chrome's extension postman test node.js(express module) program. basically, want program allow user input on postman , retrieves information somewhere in program based on user input.
so program takes in user input via postman(raw code),
[{id:0, image:tiger.jpg}, {id:1, image:cat.jpg}, {id:2, image:dog.jpg}]
then code process user input's id's only(regardless of images), , string of objects associated these 3 id's. after getting string, program send http request print objects retrieved localhost server. how able achieve using express's post , method. when use post/get? use post receive input? , use retrieve data program?
below functions thinking of including..
app.post('/', express.bodyparser(), function (req, res) {
someone suggested this. can tell me if whether or not function can receive input postman? noticed method might change req.body? don't understand how changes , parses input.
there way many questions, , apologize in advance. basically, need know how write program given description, , shall figure out rest myself!
thanks!
the bodyparser
middleware able parse json data post
ed. data put req.body
. example:
app.post('/', express.bodyparser(), function (req, res) { res.end('first id: ' + req.body[0].id); });
Comments
Post a Comment