diff options
-rw-r--r-- | README.md | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -9,21 +9,22 @@ package main import ( "net/url" + "net/http" "github.com/dougblack/sleepy" ) type Item struct { } -func (item Item) Get(values url.Values, headers map[string][]string) (int, interface{}, map[string][]string) { +func (item Item) Get(values url.Values, headers http.Header) (int, interface{}, http.Header) { items := []string{"item1", "item2"} data := map[string][]string{"items": items} - return 200, data, map[string][]string{"Content-type": {"application/json"}} + return 200, data, http.Header{"Content-type": {"application/json"}} } func main() { item := new(Item) - var api = sleepy.NewAPI() + api := sleepy.NewAPI() api.AddResource(item, "/items") api.Start(3000) } |