JavaScript Building a MEAN Application Creating and Editing Data in a MEAN App Creating Data with POST Routes in Express

Christopher Parke
Christopher Parke
21,977 Points

Where does this dance thing come from???

All of a sudden there is a dance todo in postman. I don't have that. Did he type it in offscreen? God I hate that.

Hey Christopher! I was having the same problem until I figured out a solution.

Step 1: Check inside app.js and define the parser before the router.

app.use(parser.json());
app.use('/api', router);

Step 2: In POSTMAN when POST-ing, make sure that the body content is submitted as JSON (application/json) and not as Text as it is by default.

I hope this solves your problem.

Cheers

1 Answer

Jonathan Cousins
Jonathan Cousins
7,508 Points

He had it written off screen and pasted it in.

Here is the json he wrote:

{
  "name": "Dance",
  "completed": false
}

Note: Make sure you change the post body type from Text to JSON (application/json).