Skip to content

Instantly share code, notes, and snippets.

@cyantarek
Created June 14, 2018 08:13
Show Gist options
  • Save cyantarek/af63224f99096404cbb4264358e97867 to your computer and use it in GitHub Desktop.
Save cyantarek/af63224f99096404cbb4264358e97867 to your computer and use it in GitHub Desktop.
func IndexController(c context.Context) {
var posts []Post
db.Order("created_at desc").Find(&posts)
ss := sess.Start(c)
auth := ss.Get("auth")
c.ViewData("posts", posts)
c.ViewData("auth", auth)
c.View("index.html")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment