Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
sessions
✓ github.com/gin-contrib/sessions
Sets up cookie-based sessions in a Gin application.
package main
import (
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
store := cookie.NewStore([]byte("secret"))
r.Use(sessions.Sessions("mysession", store))
r.GET("/hello", func(c *gin.Context) {
session := sessions.Default(c)
session.Set("hello", "world")
session.Save()
c.String(200, "ok")
})
r.Run()
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.1.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.