-
Notifications
You must be signed in to change notification settings - Fork 0
Build & Run
Sean Myers edited this page Jan 25, 2014
·
1 revision
It's been a bit since we've been working on this project, so I had a little bit of difficulty running the new version of the router that Sean made, but it's really pretty simple. Here's how I did it.
cd $GOPATH/src/github.com/lab-D8/food-train-server
git pull origin master
// handle any merge conflicts (which are probably just old remnants) by committing them to a random throwaway branch
(if on Ubuntu, run the makefile in $GOPATH/src/github.com/lab-D8/food-train-server/Makefile
)
Same as before, just
go install github.com/lab-D8/food-train-server (assuming your $GOPATH goes up to _src_)
This is the one that changed. In separate terminal tabs/windows do:
mongod // starts the mongodb
food-train-server// starts the router, should output 'Hello World' to begin
nc localhost 8080 // connect to the router through netcat (hooray CS 1652!)
In the netcat window, do
GET /user/new HTTP/1.1
{"first_name":"SOME NAME HERE", "last_name":"SOME LAST NAME", "password":"hunter2", "email":"EMAIL HERE"}
After a brief delay you should see a success code in your netcat window.
- If you get a HTTP/1.1 400 Bad Request then you aren't formatting your message through netcat correctly.
- If you get a HTTP/1.1 404 File Not Found then you can't correctly type '/user/new' or whatever function you're trying.
- If you get a HTTP/1.1 200 OK but you get
{"description":"Error: DB","return_code":1}
then you don't have 'mongod' running. - If you get a HTTP/1.1 200 OK and you get
{"description":"Success","return_code":0}
then everything worked! Get programming!
Just follow the steps above, except instead of netcat, point your browser to 127.0.0.1:8080/friends/add or whatever function you're testing.
Then you can add arguments by following GET URL formatting:
http://127.0.0.1:8080/friends/[email protected]&[email protected]
will encode the JSON object:
{
user : [email protected],
friend : [email protected]
}