I am using Express.js to create api and validating it through express-validator, I'm trying to send a large amount of data which consists of an array with more than 2000 objects in it. You can create the array as
const ids = Array(2000)
.fill(0)
.map((_, index) => {
return {
"A": "1",
"B": "2",
"C": "0",
"D": "MO",
"E": "1",
"F": "0",
"G": "XYZ",
"H": "000",
"I": "999"
};
});
And I'm calling the api using axios.
axios.post('/demo', {
d:ids,
});
And this is my api
app.post('/demo', async (req, res, next) => {
console.log(req.body);
const errors = validationResult(req);
console.log('---- errors', errors);
res.end('hello world');
}
);
Now when I log req.body
it shows empty object {}
. Is this because express is not able to read this array or is there anything which I'm doing wrong.