This example demonstrates a HTTP REST web service with some fixture data. Follow along the example and patterns.
Also check routes.json for the generated docs from passing the -routes flag
$ go run main.go
$ curl http://localhost:3333/
root.
$ curl http://localhost:3333/articles
[{"id":"1","title":"Hi"},{"id":"2","title":"sup"}]
$ curl http://localhost:3333/articles/1
{"id":"1","title":"Hi"}
$ curl -X DELETE http://localhost:3333/articles/1
{"id":"1","title":"Hi"}
$ curl http://localhost:3333/articles/1
"Not Found"
$ curl -X POST -d '{"id":"will-be-omitted","title":"awesomeness"}' http://localhost:3333/articles
{"id":"97","title":"awesomeness"}
$ curl http://localhost:3333/articles/97
{"id":"97","title":"awesomeness"}
$ curl http://localhost:3333/articles
[{"id":"2","title":"sup"},{"id":"97","title":"awesomeness"}]
http://stackoverflow.com/questions/31218008/sharing-a-globally-defined-db-conn-with-multiple-packages-in-golang http://www.alexedwards.net/blog/organising-database-access