diff options
Diffstat (limited to 'tests/test.go')
-rw-r--r-- | tests/test.go | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/test.go b/tests/test.go index 8ccbfbd..b36cdb6 100644 --- a/tests/test.go +++ b/tests/test.go @@ -2,21 +2,24 @@ package main import ( "net/url" - "github.com/dougblack/sleepy" ) -type Bar struct { -} +type Item struct {} + +func (item Item) Get(values url.Values) (int, interface{}) { + items := []string{"item1", "item2"} + data := map[string][]string{"items": items} -func (b Bar) Get(values url.Values) (int, interface{}) { - return 200, map[string]string{"hello": "goodbye"} + return 200, data } func main() { - bar := new(Bar) - var api = new(sleepy.Api) - api.AddResource(bar, "/bar") + item := new(Item) + + var api = new(sleepy.API) + api.AddResource(item, "/items") api.Start(3000) + } |