⚫ go ⚫ mongoDB ⚫ node
Clone it and then run
cd $GOPATH/src && git clone https://github.com/immontilla/mgo-n-goji.git
cd $GOPATH && go install mgo-n-goji/cmd/app/
To test, I am going to use Postman and its client Newman. To show the results, I'll use express and newman-reporter-html.
cd $GOPATH/src/mgo-n-goji/tests/postman/ && npm install && npm run test-n-report
$GOPATH/bin/app
- Add bob as a contact. His mobile is 600000001.
curl -iX POST "http://localhost:9889/contacts" -H "Content-Type: application/json" -d "{\"nick\":\"bob\",\"mobile\":[\"600000001\"]}" && echo ""
- Get bob's contact data
curl -iX GET "http://localhost:9889/contacts/bob" && echo ""
- Get all contacts so far
curl -iX GET "http://localhost:9889/contacts" && echo ""
- Update bob's contact data
curl -iX PUT "http://localhost:9889/contacts/bob" -H "Content-Type: application/json" -d "{\"nick\":\"bob\",\"mobile\":[\"600000001\"],\"email\":[\"[email protected]\"]}" && echo ""
- Add mobile 600000002 to a bob
curl -iX PATCH "http://localhost:9889/contacts/bob/addMobile/600000002" && echo ""
- Remove mobile 600000001 from bob
curl -iX PATCH "http://localhost:9889/contacts/bob/delMobile/600000001" && echo ""
- Add the email address [email protected] to a bob
curl -iX PATCH "http://localhost:9889/contacts/bob/addEmail/[email protected]" && echo ""
- Remove the email address [email protected] from bob
curl -iX PATCH "http://localhost:9889/contacts/bob/delEmail/[email protected]" && echo ""
- Change bob nick to bobby
curl -iX PATCH "http://localhost:9889/contacts/bob/newNick/bobby" && echo ""
- Delete bobby
curl -iX DELETE "http://localhost:9889/contacts/bobby" && echo ""