jdx / mean-sample

Sample project for Write Modern Web Apps with the MEAN Stack by Jeff Dickey
https://mean-sample.herokuapp.com
166 stars 90 forks source link

Post request fails in Chapter 4 #21

Closed vishivish18 closed 7 years ago

vishivish18 commented 9 years ago

After changing server.js to listen to listento q post request on http://localhost:3000/api/posts and defining the model it is still giving an error in postman I am sending key value pair in post man as below image (if i am removing the required condition from username and body then its saving an empty data in the collection)

postmanerror

Alayode commented 9 years ago

You should check to make sure you are not using Post on any other app on your local device computer or sandbox for that matter. I would reset my terminal/commandline and try again.

3barney commented 8 years ago

add the following piece app.use(bodyParser.urlencoded({extended: true})); before app.use(bodyParser.json());

it resolved my issue using postman

felixfrtz commented 7 years ago

Try these settings:

image

image

vishivish18 commented 7 years ago

@warhost I even forgot about this thing , I had this issue long time back, but thanks for your reply though, I appreciate it 👍 I am closing this now