Skip to content

Neko handler that provides a Session service. (session store provider)

License

Notifications You must be signed in to change notification settings

neko-contrib/sessions

Repository files navigation

#sessions GoDoc GoCover

Neko middleware/handler that provides a Session service.

Usage

package main
import (
  "github.com/rocwong/neko"
  "github.com/neko-contrib/sessions"
)

func main() {
  m := neko.New()

  m.Use(sessions.Sessions("sess_neko", sessions.NewCookieStore([]byte("secret123"))))

  m.GET("/", func (ctx *neko.Context) {
    ctx.Session.Set("myvalue", "Session Save")
    ctx.Text("Session Save")
  })
  m.GET("/get", func (ctx *neko.Context) {
    ctx.Text(ctx.Session.Get("myvalue"))
  })

  m.GET("/flash", func (ctx *neko.Context) {
    ctx.Session.AddFlash("Flash Session")
    ctx.Text("Flash Save")
  })
  m.GET("/getflash", func (ctx *neko.Context) {
    ctx.Text(ctx.Session.Flashes())
  })

  m.Run(":3000")
}

About

Neko handler that provides a Session service. (session store provider)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages