From ef180141424c9991af7bc614d2b6809f731fe88f Mon Sep 17 00:00:00 2001 From: Doug Black Date: Thu, 23 Jan 2014 22:23:01 -0800 Subject: add response --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 62aa8ac..2d4b141 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,10 @@ import ( type Item struct { } func (item *Item) Get(foo string, bar int) (interface{}, int, http.Headers) { - return map[string]int { foo : bar}, 200, nil + data := map[string]int { + foo : bar + } + return data, 200, nil } func main() { @@ -24,10 +27,18 @@ func main() { var api = new(sleepy.Api) api.AddResource(item, "/item") - request, _ := http.NewRequest("GET", "/item", nil) + request, _ := http.NewRequest("GET", "/item", "foo=thing&bar=5") fmt.Println(api.HandleRequest(request)) } ``` +With a response of + +``javascript +{ + "thing": 5 +} +``` + Stay tuned. -- cgit