mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Examples changes (#201)
This commit is contained in:
@@ -12,13 +12,12 @@ import (
|
||||
func HandlePostCreate(db *database.Database, auth map[string]interface{}) {
|
||||
var post *models.Post
|
||||
|
||||
err := json.Unmarshal([]byte(os.Getenv("PAYLOAD")), &post)
|
||||
if err != nil {
|
||||
fmt.Println("Invalid post")
|
||||
if err := json.NewDecoder(os.Stdin).Decode(&post); err != nil {
|
||||
fmt.Printf("Couldn't decode post JSON: %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
post, err = db.SavePost(post)
|
||||
post, err := db.SavePost(post)
|
||||
if err != nil {
|
||||
fmt.Println("Couldn't save that post")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user