Example #1
0
func ManageSession(w http.ResponseWriter, r *http.Request) *session.JustilySession {
	if isSessionCookieAvailable(r) {
		c, _ := r.Cookie(sessionCookieName)
		if isValidSessionCookie(c) {
			return session.GetSession(c.Value)
		}
	}
	js := session.NewSession()
	cookie := &http.Cookie{Name: "sid", Value: js.Id.String()}
	http.SetCookie(w, cookie)
	return js
}
Example #2
0
func home(w http.ResponseWriter, r *http.Request) {
	s := session.NewSession()
	fmt.Println("blah", s)
	fmt.Fprintf(w, "Hello Kranthi!!!")
}