2

I am getting 'Entity Too large' while post json in node js. My expreess js version is 4.16.1.

I am gone through all answer from this thread https://stackoverflow.com/questions/19917401/error-request-entity-too-large

KARTHIKEYAN.A
  • 11,752
  • 4
  • 81
  • 93
Maulik Patel
  • 604
  • 1
  • 8
  • 21

2 Answers2

0

After So many try I got my solution

I have commented this line

app.use(bodyParser.json());

and I put app.use(bodyParser.json({limit: '50mb'}))

Than it works

Maulik Patel
  • 604
  • 1
  • 8
  • 21
  • Answer is already there why you creating duplicate questions? @Maulik Patel https://stackoverflow.com/a/36514330/4652706 – KARTHIKEYAN.A Sep 18 '18 at 05:32
  • I have created new Question to specific Express Version. In last Thread they were talking about express version below 4.0 and no one mentioned to comment app.use(bodyParser.json()); line – Maulik Patel Sep 18 '18 at 10:06
  • That is not enough to create questions, read the document again before create another question. @Maulik Patel. – KARTHIKEYAN.A Sep 18 '18 at 11:30
0

Add this parameter as middle ware in your main js file

var express = require('express'); 
var app = express();
app.use(express.json({limit: 1024102420}));
app.use( bodyParser.json({parameterLimit: 50000,limit:1024102420,type:'application/json'}) );     // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({parameterLimit: 50000, limit: 1024102420,    // to support URL-encoded bodies
  extended: true
  }));
Prashant Gupta
  • 789
  • 7
  • 23