blob: 53c7f9edacf731bc757d601fc51d4fca178cc824 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package main
import (
"sleepy"
"net/url"
)
type Bar struct {
sleepy.PostNotSupported
sleepy.PutNotSupported
sleepy.DeleteNotSupported
}
func (b Bar) Get(values ...url.Values) (int, interface{}) {
return 200, map[string]string{"hello": "goodbye"}
}
type Baz struct {
sleepy.PostNotSupported
sleepy.PutNotSupported
sleepy.DeleteNotSupported
}
func main() {
bar := new(Bar)
var api = new(sleepy.Api)
api.AddResource(bar, "/bar")
api.Start(3000)
}
|