jdx / mean-sample

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

http://localhost:3000/api/posts Returns Empty Array #5

Closed mchavezi closed 9 years ago

mchavezi commented 9 years ago

I am following along with the book. After page 45 "MongoDB Models with Mongoose" http://localhost:3000/api/posts returns an empty array.

I also cloned the mean-sample ch4 repo got the same results.

jdx commented 9 years ago

Do you have anything in the database?

On Sat, Nov 15, 2014 at 10:44 PM, Michael Chavez notifications@github.com wrote:

I am following along with the book. After page 45 "MongoDB Models with Mongoose" http://localhost:3000/api/posts returns an empty array.

I also cloned the mean-sample ch4 repo got the same results.

Reply to this email directly or view it on GitHub: https://github.com/dickeyxxx/mean-sample/issues/5

mchavezi commented 9 years ago

Yup. I got it working by visiting the localhost:3000, that must have triggered it being in the db, because after that it worked.

jdx commented 9 years ago

Hmm strange, I don't know why that path would matter

On Sat, Nov 15, 2014 at 10:56 PM, Michael Chavez notifications@github.com wrote:

Yup. I got it working by visiting the localhost:3000, that must have triggered it being in the db, because after that it worked.

Reply to this email directly or view it on GitHub: https://github.com/dickeyxxx/mean-sample/issues/5#issuecomment-63207598

mchavezi commented 9 years ago

I am not sure how it started working actually, kinda like magic at this point.

but when I do curl -v -H "Content-Type: application/json" -XPOST --data "{\"username\":\"dickeyxxx\", \"body\":\"foo\"}" localhost:3000/api/posts, it does update the api, which is pretty cool;)