Documentation
¶
Overview ¶
Package sessions provides a sessions middleware that works well (but not exclusively) with rkusa/web(https://github.com/rkusa/web).
app := app.New() app.Use(sessions.Middleware("testsid", sessions.NewCookieStore([]byte("your-secret-key")))) add this
Read session
sessions := sessions.FromContext(r.Context()) fmt.Println(sessions["foo"])
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext reads the session from the given context.
func Middleware ¶
func Middleware(name string, store Store) func(http.ResponseWriter, *http.Request, http.HandlerFunc)
Middleware returns a middleware.
Types ¶
type CookieStore ¶
type CookieStore interface { Store }
func NewCookieStore ¶
func NewCookieStore(keyPairs ...[]byte) CookieStore
NewCookieStore creates a new CookieStore with the given key pairs.
Click to show internal directories.
Click to hide internal directories.