1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 15:18:20 +00:00

Subcontext and mapping updates

This commit is contained in:
Darren Shepherd
2017-11-21 13:46:30 -07:00
parent 3ba704aef1
commit 38c9c5c6c3
78 changed files with 1694 additions and 996 deletions

27
api/handler/create.go Normal file
View File

@@ -0,0 +1,27 @@
package handler
import (
"net/http"
"github.com/rancher/norman/types"
)
func CreateHandler(apiContext *types.APIContext) error {
var err error
data, err := ParseAndValidateBody(apiContext)
if err != nil {
return err
}
store := apiContext.Schema.Store
if store != nil {
data, err = store.Create(apiContext, apiContext.Schema, data)
if err != nil {
return err
}
}
apiContext.WriteResponse(http.StatusCreated, data)
return nil
}