Exemple #1
0
func Bind(h dav.Handle) httprouter.Handle {
	return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
		s := session.Start(w, r)
		// auth TODO
		c := dav.NewContext(w, r, p, s)
		h(c)
	}
}
Exemple #2
0
func Login(w http.ResponseWriter, r *http.Request) {
	sess := session.Start(w, r)
	sess.Set("id", 123)
	user_id, _ := sess.Get("id")
	fmt.Fprintf(w, "user id %d", user_id.(int))
}