diff options
-rw-r--r-- | README.md | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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. |