rake db:setup
This will setup the database, tables, and a couple initial missions.
Notes: You have to have mongodb running.
To make testing way easier, use the Chrome Extension called Postman - REST Client
chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en
Simple GET request that returns all missions:
curl -i -H "Accept: application/json" http://localhost:3000/api/v1/missions/ *Pick an id from the list. Store that mentally as {valid_id}
This can also accept a search based on the name parameters. For example:
curl -i -H "Accept: application/json" http://localhost:3000/api/v1/missions/?name=Goodwill
Successful: (name, image and global points are all set)
curl --data "name=mediocrewill&image=mediocrewill.png&goal_points=10000000" http://localhost:3000/api/v1/missions/
Missing data: (name, image or global points not there)
curl --data "image=mediocrewill.png¤t_points=0&goal_points=10000000" http://localhost:3000/api/v1/missions/
Not missing any parameters, but provided invalid data.
curl --data "name=&image=mediocrewill.png¤t_points=0&goal_points=10000000" http://localhost:3000/api/v1/missions/
Sucessful: (Valid parameters and valid id)
curl -X PUT -d image=test http://localhost:3000/api/v1/missions/{valid_id}
Can’t find ID:
curl -X PUT -d image=test http://localhost:3000/api/v1/missions/123
Can find ID but invalid parameters.
curl -X PUT -d name="" http://localhost:3000/api/v1/missions/{valid_id}
Successful:
curl -X DELETE "http://localhost:3000/api/v1/missions/{valid_id}"
Can’t find the id to delete:
curl -X DELETE "http://localhost:3000/api/v1/missions/1123"