Mittwoch, 18. Mai, 2016
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
MongoDB CRUD the MVC way with Passport Authentication 56<br />
1 $ node server<br />
and issue the POST request with the following request body:<br />
1 {<br />
2 "name": "Kevin",<br />
3 "email": "kevin@mitnick.com",<br />
4 "username": "Condor",<br />
5 "password": "AintNoBodyGotTimeForGoodPa$words!!!"<br />
6 }<br />
You can use the curl command like this:<br />
1 $ curl -X POST -H "Content-Type: application/json" -d '{"name": "Kevin", "email"\<br />
2 : "kevin@mitnick.com", "username": "Condor", "password": "AintNoBodyGotTimeForGo\<br />
3 odPa$words!!!"}' localhost:1337/users<br />
but I suggest you use a GUI tool since it will make things easier. I personally use Postman¹¹⁰ in<br />
Chrome, but I’m sure there’s also a dozen of plugins for your favorite browser. However, if you<br />
followed all the steps you will notice that this curl command or Postman’s POST aren’t working<br />
(sneaky, huh? ;)):<br />
postmanFail<br />
¹¹⁰https://www.google.hr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&<br />
uact=8&ved=0CB0QFjAA&url=https%3A%2F%2Fchrome.google.com%2Fwebstore%2Fdetail%2Fpostman-rest-client%<br />
2Ffdmmgilgnpjigdojojpjoooidkmcomcm&ei=GniuVMHZFYH9UMiSg9gC&usg=AFQjCNFL71vN61QG0LKlw7VDJvIZDprjHA&<br />
sig2=DUyqMgSFn1BFnWzvNlf_Sg