Files
fn-serverless/examples/blog/routes/post_read.go
Travis Reeder 48e3781d5e Rename to GitHub (#3)
* circle

* Rename to github and fn->cli

*  Rename to github and fn->cli
2017-07-26 10:50:19 -07:00

27 lines
395 B
Go

package route
import (
"os"
"github.com/fnproject/fn/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,
})
}