Regenerate front page in each call
This commit is contained in:
parent
a743177282
commit
106fd5bfaf
1 changed files with 3 additions and 3 deletions
|
@ -35,10 +35,10 @@ type indexData struct {
|
|||
}
|
||||
|
||||
func indexHandler(coll *mgo.Collection) func(http.ResponseWriter, *http.Request) {
|
||||
var data indexData
|
||||
data.Count, _ = coll.Count()
|
||||
coll.Find(bson.M{}).Sort("-_id").Limit(10).All(&data.Books)
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var data indexData
|
||||
data.Count, _ = coll.Count()
|
||||
coll.Find(bson.M{}).Sort("-_id").Limit(10).All(&data.Books)
|
||||
loadTemplate(w, "index", data)
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue