diff options
author | Doug Black <dougblack@gatech.edu> | 2014-01-23 22:23:01 -0800 |
---|---|---|
committer | Doug Black <dougblack@gatech.edu> | 2014-01-23 22:23:01 -0800 |
commit | ef180141424c9991af7bc614d2b6809f731fe88f (patch) | |
tree | 030f5261edb007f6a9d4744d89a428ab48039bc5 /README.md | |
parent | add readme (diff) | |
download | sleepy-ef180141424c9991af7bc614d2b6809f731fe88f.tar.gz sleepy-ef180141424c9991af7bc614d2b6809f731fe88f.tar.bz2 sleepy-ef180141424c9991af7bc614d2b6809f731fe88f.zip |
add response
Diffstat (limited to 'README.md')
-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. |