Example #1
0
func Test(store *mysqlstore.MySQLStore, db *sql.DB) httpFunc {
	f := func(w http.ResponseWriter, r *http.Request) {
		m := "Hello World!"
		session, _ := store.Get(r, "xUser")
		fmt.Println("foo=", session.Values["foo"])
		fmt.Println("42=", session.Values)
		fmt.Fprint(w, m)
	}
	return f
}
Example #2
0
func Index(store *mysqlstore.MySQLStore, db *sql.DB) httpFunc {
	f := func(w http.ResponseWriter, r *http.Request) {
		t, err := template.ParseFiles(viewUrl+"index.html", viewUrl+"header.html", viewUrl+"footer.html")
		fmt.Println("terr==", err)
		p := mydata(db)
		session, err := store.Get(r, "xUser")
		fmt.Println("BBB=", err)
		session.Values["foo"] = "bar"
		session.Values[42] = 43
		session.Save(r, w)

		t.Execute(w, p)
	}
	return f
}