diff --git a/README.md b/README.md index 2b6e8733c..3ab28f91e 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,11 @@ Norman ======== -An API framework for Building [Rancher Style APIs](https://github.com/rancher/api-spec/) backed by K8s CustomResources. - -## Building - -`make` +An API framework for Building [Rancher Style APIs](https://github.com/rancher/api-spec/) backed by K8s CustomResources and their controllers. ## Example -Refer to `examples/` - -```go -package main - -import ( - "context" - "fmt" - "net/http" - "os" - - "github.com/rancher/norman/generator" - "github.com/rancher/norman/server" - "github.com/rancher/norman/types" -) - -type Foo struct { - types.Resource - Name string `json:"name"` - Foo string `json:"foo"` - SubThing Baz `json:"subThing"` -} - -type Baz struct { - Name string `json:"name"` -} - -var ( - version = types.APIVersion{ - Version: "v1", - Group: "io.cattle.core.example", - Path: "/example/v1", - } - - Schemas = types.NewSchemas() -) - -func main() { - if _, err := Schemas.Import(&version, Foo{}); err != nil { - panic(err) - } - - server, err := server.NewAPIServer(context.Background(), os.Getenv("KUBECONFIG"), Schemas) - if err != nil { - panic(err) - } - - fmt.Println("Listening on 0.0.0.0:1234") - http.ListenAndServe("0.0.0.0:1234", server) -} -``` - +Refer to https://github.com/rancher/go-skel for skeleton norman controller projects ## License Copyright (c) 2014-2017 [Rancher Labs, Inc.](http://rancher.com)