package main

import (
	"fmt"
	"net/http"

	"github.com/ymichael/sessions"
	"github.com/zenazn/goji"
	"github.com/zenazn/goji/web"
)

var (
	Sessions = sessions.NewSessionOptions("thisismysecret.", &sessions.MemoryStore{})
)

func hello(c web.C, w http.ResponseWriter, r *http.Request) {
	x := Sessions.GetSession(&c)
	if val, ok := x["count"]; ok {
		x["count"] = val.(int) + 1
	} else {
		x["count"] = 1
	}
	fmt.Fprintf(w, "Hello, %d!", x["count"])
}

func main() {
	goji.Use(Sessions.Middleware())
	goji.Get("/", hello)
	goji.Serve()
}

package main

import (
	"fmt"
	"net/http"

	"github.com/ymichael/sessions"
	"github.com/zenazn/goji"
	"github.com/zenazn/goji/web"
)

var (
	Sessions = sessions.NewSessionOptions("thisismysecret.", &sessions.MemoryStore{})
)

func hello(c web.C, w http.ResponseWriter, r *http.Request) {
	x := Sessions.GetSessionObject(&c)
	if val, ok := x["count"]; ok {
		x["count"] = val.(int) + 1
	} else {
		x["count"] = 1
	}
	fmt.Fprintf(w, "Hello, %d!", x["count"])
}

func destroy(c web.C, w http.ResponseWriter, r *http.Request) {
	Sessions.DestroySession(&c, w)
	http.Redirect(w, r, "/", 301)
}

func main() {
	goji.Use(Sessions.Middleware())
	goji.Get("/", hello)
	goji.Get("/destroy", destroy)
	goji.Serve()
}

Add ability to delete sessions.
Add ability to delete sessions.
