Skip to content

Commit

Permalink
Merge pull request #217 from ibuildthecloud/master
Browse files Browse the repository at this point in the history
Update readme to refer to go-skel
  • Loading branch information
ibuildthecloud authored Oct 31, 2018
2 parents 6c7654a + aea43f1 commit 0dbd456
Showing 1 changed file with 2 additions and 57 deletions.
59 changes: 2 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 0dbd456

Please sign in to comment.