https://github.com/alecthomas/rest
https://github.com/alecthomas/rest
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/alecthomas/rest
- Owner: alecthomas
- Created: 2018-07-30T00:14:32.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-01T08:43:35.000Z (over 2 years ago)
- Last Synced: 2025-02-18T17:05:46.980Z (over 1 year ago)
- Language: Go
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# An opinionated API for building RESTful services
```go
type todoService struct {}
func (t *todoService) CreateTodo(todo *Todo) error { return nil }
func (t *todoService) DeleteTodo(id string) (*Todo, error) { return nil, nil }
func (t *todoService) AddChild(parent string, todo *Todo) error { return nil }
todo := &todoService{}
api := rest.New()
api.Post("/todo", todo.CreateTodo).
api.Delete("/todo/:id", todo.DeleteTodo).
api.Post("/todo/:id/children", todo.AddChild).
```