{"@context":"https://w3id.org/codemeta/3.0","@type":"SoftwareSourceCode","identifier":"pkg:golang/github.com/tmc/rest","name":"github.com/tmc/rest","description":"Package rest provides a micro framework for writing json HTTP endpoints Inspiration from dougblack's sleepy Example: package main import ( \"fmt\" \"io/ioutil\" \"net/http\" \"net/url\" \"github.com/tmc/rest\" ) type User struct { Name string } type UserRepository struct { users []User } func (ur UserRepository) AllUsers() []User { return ur.users } type UserList struct { repo UserRepository } func (ul UserList) Get(values url.Values) (int, interface{}) { return http.StatusOK, ul.repo.AllUsers() } func main() { a := rest.API{} a.AddResource(\"/users\", UserList{UserRepository{[]User{{\"joe\"}, {\"sally\"}}}}) go a.Start(8080) resp, err := http.Get(\"http://127.0.0.1:8080/users\") if err != nil { panic(err) } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) fmt.Println(resp.Status, string(body)) // Output: // 200 OK [{\"Name\":\"joe\"},{\"Name\":\"sally\"}] }","version":"v0.0.0-20140127185225-b26b717b27c4","softwareVersion":"v0.0.0-20140127185225-b26b717b27c4","license":"https://spdx.org/licenses/ISC","codeRepository":"https://github.com/tmc/rest","issueTracker":"https://github.com/tmc/rest/issues","url":"https://github.com/tmc/rest","programmingLanguage":{"@type":"ComputerLanguage","name":"Go"},"dateCreated":"2014-01-27","dateModified":"2014-01-27","datePublished":"2014-01-27","copyrightYear":2014,"downloadUrl":"https://proxy.golang.org/github.com/tmc/rest/@v/v0.0.0-20140127185225-b26b717b27c4.zip","softwareHelp":{"@type":"WebSite","url":"https://pkg.go.dev/github.com/tmc/rest#section-documentation"},"applicationCategory":"go","runtimePlatform":"go","developmentStatus":"active","sameAs":["https://pkg.go.dev/github.com/tmc/rest"],"https://www.w3.org/ns/activitystreams#likes":3}