Files
fn-serverless/examples/blog/routes/post_read.go
Carlos C d5fb1afda7 Revert "Assert License (#224)"
This reverts commit a61c4dab78.
2016-11-06 09:25:12 -08:00

27 lines
400 B
Go

package route
import (
"os"
"github.com/iron-io/functions/examples/blog/database"
)
func HandlePostRead(db *database.Database, auth map[string]interface{}) {
id := os.Getenv("PARAM_ID")
if id == "" {
SendError("Missing post ID")
return
}
post, err := db.GetPost(id)
if err != nil {
SendError("Couldn't retrieve that post")
return
}
SendResponse(Response{
"post": post,
})
}