aboutsummaryrefslogtreecommitdiff
path: root/tests/test.go
diff options
context:
space:
mode:
authorDoug Black <dblack@twilio.com>2014-01-27 10:41:28 -0500
committerDoug Black <dblack@twilio.com>2014-01-27 10:41:28 -0500
commit0a2d08f88e0a25d8fe388647abdfad029ca6a0b7 (patch)
tree31ed7a9147b4ac5b4354b00edcaa1f0db4c386b4 /tests/test.go
parentadd license (diff)
downloadsleepy-0a2d08f88e0a25d8fe388647abdfad029ca6a0b7.tar.gz
sleepy-0a2d08f88e0a25d8fe388647abdfad029ca6a0b7.tar.bz2
sleepy-0a2d08f88e0a25d8fe388647abdfad029ca6a0b7.zip
use ServeMux, capitalize API, clean tests
Diffstat (limited to 'tests/test.go')
-rw-r--r--tests/test.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/test.go b/tests/test.go
index d3f414c..adff27a 100644
--- a/tests/test.go
+++ b/tests/test.go
@@ -5,18 +5,23 @@ import (
"sleepy"
)
-type Bar struct {
+type Item struct {
sleepy.BaseResource
}
-func (b Bar) Get(values url.Values) (int, interface{}) {
- return 200, map[string]string{"hello": "goodbye"}
+func (item Item) Get(values url.Values) (int, interface{}) {
+ items := []string{"item1", "item2"}
+ data := map[string][]string{"items": items}
+
+ 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)
+
}
bgstack15