func NewDoc(request *http.Request) (Doc, error) {
	var doc Doc
	defer request.Body.Close()

	if body, err := ioutil.ReadAll(request.Body); err != nil {
		return doc, err
	} else if err := json.Unmarshal(body, &doc); err != nil {
		return doc, err
	}

	doc.Created = time.Now().UTC().Format(time.RFC3339)
	doc.Touched = doc.Created

	return doc, nil
}
// NewDoc Create a new document from an HTTP request
NewDoc Create a new document from an HTTP request
// NewDoc Create a new document from an HTTP request
func NewDoc(request *http.Request) (Doc, error) {
	var doc Doc
	defer request.Body.Close()
	if body, err := ioutil.ReadAll(request.Body); err != nil {
		return doc, err
	} else if err := json.Unmarshal(body, &doc); err != nil {
		return doc, err
	}
	doc.Created = time.Now().UTC().Format(time.RFC3339)
	doc.Touched = doc.Created
	return doc, nil
}
func NewDoc ( request * http . Request ) ( Doc , error ) { var doc Doc defer request . Body . Close ( ) if body , err := ioutil . ReadAll ( request . Body ) ; err != nil { return doc , err } else if err := json . Unmarshal ( body , & doc ) ; err != nil { return doc , err } doc . Created = time . Now ( ) . UTC ( ) . Format ( time . RFC3339 ) doc . Touched = doc . Created return doc , nil }
NewDoc Create a new document from an HTTP request
NewDoc Create a new document from an HTTP request