Session
Installation
go get github.com/go-macaron/sessionUsage
import (
"github.com/go-macaron/session"
"gopkg.in/macaron.v1"
)
func main() {
m := macaron.Classic()
m.Use(macaron.Renderer())
m.Use(session.Sessioner())
m.Get("/", func(sess session.Store) string {
sess.Set("session", "session middleware")
return sess.Get("session").(string)
})
m.Get("/signup", func(ctx *macaron.Context, f *session.Flash) {
f.Success("yes!!!")
f.Error("opps...")
f.Info("aha?!")
f.Warning("Just be careful.")
ctx.HTML(200, "signup")
})
m.Run()
}Pongo2
Output flash in current response
Options
Providers
Memory
File
Redis
Memcache
PostgreSQL
MySQL
Couchbase
Ledis
Nodb
Implement Provider Interface
Last updated
Was this helpful?