DEV Community

Discussion on: FullStack setup (Node.js, React.js and MongoDB)

 
pacheco profile image
Thiago Pacheco

Greaaaat!! Very glad to help :D

Thread Thread
 
francisvila profile image
Francis Vila

Hi Thiago,
I have a similar problem to the one reported by @tomrains , but the answer you gave did not allow me to solve it.
(Note: I'm new to Postman)
the response I get for localhost:5000/api/product?name=to... is
{"error":false,"product":{"id":"5ee204bbf1af38409c11d4de","_v":0}}
the response code is 201 Created.
In the Pretty - Raw - Preview section, I can't edit, it's read only
I added a Content-type: raw section in the headers but that didn't change anything.
I tried using curl, with this command: curl --location --request POST "localhost:5000/api/product" --header "Content-Type: raw" -d '{"name":"toto","description":"tata"}'
but the result seems to be the same...

Here's a screenshot of my postman app:
dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
pacheco profile image
Thiago Pacheco

Hi Francis.

In your screenshot, I can see that you are sending query params with the values when you should actually be sending body data in postman.
You can select the body option and you will have a raw option below it.

Follow a screenshot below with an example:
dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
francisvila profile image
Francis Vila

thank you so much, Thiago! That was really quick! It works now. It seems obvious once you know where to look.