Skip to content

pastebt/sess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sess

Simple easy Session System

Install

go get github.com/pastebt/sess

Usage

Init

You have to init the session system when your server start, give the path where to save persistent data for your session.

import "github.com/pastebt/sess"

sess.Init("/path/to/save/data/")

If set path as "", session will keep in memory and will be lost when server stop.

Get / Set session

In a net/http handler function, you can use it like this:

func handler(w ResponseWriter, r *Request) {
  s := sess.Start(w, r)
  name := s.Get("username")
  s.Set("password", "whateveryourpassword")
  
  ...
  
}

About

simple easy session

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published