My node.js script is receiving HTML POST request calls from the google Chrome extension Postman but it's not seeing the key-value pairs. Keeps giving me
TypeError: Cannot read property 'username' of undefined
at app.get.params.QueueUrl (/home/ec2-user/Outfitr/Server/index.js:45:53)
at Layer.handle [as handle_request] (/home/ec2-user/Outfitr/Server/node_modules/express/lib/router/layer.js:82:5)
at next (/home/ec2-user/Outfitr/Server/node_modules/express/lib/router/route.js:110:13)
at Route.dispatch (/home/ec2-user/Outfitr/Server/node_modules/express/lib/router/route.js:91:3)
at Layer.handle [as handle_request] (/home/ec2-user/Outfitr/Server/node_modules/express/lib/router/layer.js:82:5)
at /home/ec2-user/Outfitr/Server/node_modules/express/lib/router/index.js:267:22
at Function.proto.process_params (/home/ec2-user/Outfitr/Server/node_modules/express/lib/router/index.js:321:12)
at next (/home/ec2-user/Outfitr/Server/node_modules/express/lib/router/index.js:261:10)
at serveStatic (/home/ec2-user/Outfitr/Server/node_modules/express/node_modules/serve-static/index.js:59:14)
at Layer.handle [as handle_request] (/home/ec2-user/Outfitr/Server/node_modules/express/lib/router/layer.js:82:5)
Here's my code. Let me know if you need anything else
app.post('/bscreateuser', function(request, response) {
process.stdout.write("Attempted to create a --- BBBSSSSS ---- user | ");
process.stdout.write("request is " + request.url);
process.stdout.write("username is " + request.body.username);
process.stdout.write("Password is " + request.body.password);
bscreateUser(request.query.username, request.body.password);
response.send('Success' );
});
function bscreateUser(username, password) {
messageBody = 'create_user("' + username + '","' + password + '")';
queueUrl = DAO_QUEUE_URL;
// sys.puts("--- going for BS ---");
sendSQSMessage(JSON.stringify(messageBody), queueUrl);
}
request.query.usernameberequest.body.username? - mscdex