[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
jsonParser use defualt limit value
i want to custom limit value in jsonParser
Nest version: 4.6.1
For Tooling issues:
- Node version: 9.6.0
- Platform: Linux
this issue should be asked in Stackoverflow in #nestjs tag.
but anyway, here is an example to achieve this,
in your bootstrap function in main.ts
...
import { json } from 'body-parser';
...
const instance = express();
instance.use(json({ limit: '50mb' // edit this }));
const app = await NestFactory.create(AppModule, instance, {
bodyParser: false, // tells nest: don't use your bodyParser, we will take care of it.
});
...
await app.listen(3000);
Actually, this should be enough:
import { json } from 'body-parser';
//////
const app = await NestFactory.create(AppModule);
app.use(json({ limit: '50mb' // edit this }))
await app.listen(3000);
@shekohex in package @nestjs/core, it provider support with body parser, but could not configuration it, just like set limit value, i want to add configuration support for these
@twilroad I have posted above how to do that. When you apply body-parser
middleware with your custom configuration, this one built-in nest won't be applied again.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Actually, this should be enough: