uiok is a Go framework for building RESTful APIs that fully embrace the
HATEOAS principle ("Hypermedia As The Engine Of Application State").
It provides abstractions for defining resources, generating hypermedia controls
(links and actions), and constructing dynamic, discoverable API responses.
- Component-based: Define reusable units of UI logic and rendering.
- Composite support: Nest and aggregate components for complex UIs.
- Validation abstraction: Integrate form and input validation logic cleanly.
- HTTP compatibility: Bind component data directly from HTTP forms.
TODO
A basic usage example can be found in the examples/ folder.
Here’s a minimal example:
package main
import (
"os"
"context"
"github.com/candango/uiok/uiok"
)
type HelloComponent struct {}
func (h *HelloComponent) Partial() ([]byte, error) { return []byte("<p>Hello, world!</p>"), nil }
func (h *HelloComponent) Render() ([]byte, error) { return h.Partial() }
func (h *HelloComponent) Change(ctx context.Context) error { return nil }
func main() {
c := &HelloComponent{}
_ = uiok.Write(os.Stdout, c)
}Issues and pull requests are welcome! Please see our contributing guidelines for details.