Skip to content
This repository has been archived by the owner on Mar 21, 2019. It is now read-only.

tango-contrib/flash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flash CircleCI

Middleware flash is a tool for share data between requests for Tango.

Notice

This is a new version, it stores all data via session not cookie. And it is slightly non-compitable with old version.

Installation

go get github.com/tango-contrib/flash

Simple Example

import "github.com/tango-contrib/session"

type FlashAction struct {
    flash.Flash
}

func (x *FlashAction) Get() {
    x.Flash.Set("test", "test")
}

func (x *FlashAction) Post() {
   x.Flash.Get("test").(string) == "test"
}

func main() {
    t := tango.Classic()
    sessions := session.Sessions()
    t.Use(flash.Flashes(sessions))
    t.Any("/", new(FlashAction))
    t.Run()
}

License

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