kuvia2/vendor/github.com/flamego/session/README.md
2022-01-15 00:09:03 +01:00

1.5 KiB

session

GitHub Workflow Status Codecov GoDoc Sourcegraph

Package session is a middleware that provides the session management for Flamego.

Installation

The minimum requirement of Go is 1.16.

go get github.com/flamego/session

Getting started

package main

import (
	"github.com/flamego/flamego"
	"github.com/flamego/session"
)

func main() {
	f := flamego.Classic()
	f.Use(session.Sessioner())
	f.Get("/", func(s session.Session) {
		s.Set("user_id", 123)
		userID, ok := s.Get("user_id").(int)
		// ...
	})
	f.Run()
}

Getting help

License

This project is under the MIT License. See the LICENSE file for the full license text.