2

So, I'm trying to Post JSON to my NodeJS Backend. Here's my NodeJS backend address: http://128.199.11.11:3008/receiveNotif

And Here's the JSON format:

{
  "status_code": "200",
  "status_message": "notification",
  "t_id": "8456f852-9a65-4ab6-8ccb-5e0275b03d71",
  "o_id": "100030001_20160211_011644",  
  "signature_key": "6f7afa238561f055122d6fc0c40de98cd7341d481179405b6e57d9a94c436a089bf6bb2e6fe874d1c5dee0cf103f59e372ea586813f68b75438b1148d7685e29"
}

And this is my nodeJS backend to handle the JSON:

router.post('/receiveNotif', function(request, response, body, result) {
    var url = 'http://128.199.11.11:3008';

    console.log(request.body);
    console.log(body);
    response.json(body);
  });

When I ty to POST the JSON to my backend, it gives me error.

Am I missing something in my NodeJS backend? Help me, what can I do to handle those JSON in my backend?

SOLVED

yogieputra
  • 597
  • 1
  • 11
  • 25

1 Answers1

1

I'm using this How do you extract POST data in Node.js? as a reference. Thanks to @Mahn answer. It gives me great insight of handle POST json.

Community
  • 1
  • 1
yogieputra
  • 597
  • 1
  • 11
  • 25