mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
19 lines
336 B
Go
19 lines
336 B
Go
package route
|
|
|
|
import (
|
|
"github.com/treeder/functions/examples/blog/database"
|
|
"gopkg.in/mgo.v2/bson"
|
|
)
|
|
|
|
func HandlePostList(db *database.Database, auth map[string]interface{}) {
|
|
posts, err := db.GetPosts([]bson.M{})
|
|
if err != nil {
|
|
SendError("Couldn't retrieve posts")
|
|
return
|
|
}
|
|
|
|
SendResponse(Response{
|
|
"posts": posts,
|
|
})
|
|
}
|