2

I am trying to get data sent by postman row->text data but fail to get. I am able to print complete body but how do i print body param? body is in the form of query string. enter image description here

NodeCode:

   const bodyParser = require("body-parser"); 
   app.use(bodyParser.urlencoded({
            extended: true
    }));
    app.use(bodyParser.json());
    app.use(bodyParser.text());
    app.post('/data/UploadLogsToServer', async (req, res) => {
            return res.json(req.body);
    });

above code prints complete body like enter image description here

But How do i fetch only Store parameter from query string ?

Community
  • 1
  • 1
Juned Ansari
  • 5,035
  • 7
  • 56
  • 89

1 Answers1

1

querystring npm module resolved my problem

Solution:

var querystring = require('querystring');
app.post('/data/UploadLogsToServer', async (req, res) => {
        var q = querystring.parse(req.body);
        return res.json(q.Store);
});
Juned Ansari
  • 5,035
  • 7
  • 56
  • 89