Closed hoangnq3004 closed 4 years ago
Hi @hoangnq3004, the provided information is not sufficient for me to efficiently help you. I can have a look if you could provide me with a minimal reproduction case (as in here).
You can have a look at your bootstrap
-Function though, any body-parser instance that deals with application/json
can cause your project to hang.
Sorry for my information!
You can see at https://github.com/hoangnq3004/nextjs-nestjs-integration-example
Since Next.js already parsed the payloads, the body-parser instance that NestJS enables by default will be passed a non-string body. This causes it to hang.
You'll need to disable body-parser:
const app = await NestFactory.create(AppModule, { bodyParser: false });
I've extended the blog post to cover this.
Thank you!
Hi @Skn0tt !
I want post data to http://localhost:3000/api/randomNumber with 'Content-Type': 'application/json' but NestJS controller can't receiva data.
app.controller.ts
.babelrc
When remove 'Content-Type', NestJS cant receive Body data, but I need JSON.parse it!