mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
8.4.0 | New MVC Features | Refactor examples and godoc for go 1.9 use. Read HISTORY.md.
Former-commit-id: 90c05e743052bc3722e7fefaa0cbb0ed5153a1fb
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/kataras/iris"
|
||||
"github.com/kataras/iris/context"
|
||||
|
||||
"github.com/kataras/iris/sessions"
|
||||
)
|
||||
@@ -11,13 +10,13 @@ func main() {
|
||||
app := iris.New()
|
||||
sess := sessions.New(sessions.Config{Cookie: "myappsessionid"})
|
||||
|
||||
app.Get("/set", func(ctx context.Context) {
|
||||
app.Get("/set", func(ctx iris.Context) {
|
||||
s := sess.Start(ctx)
|
||||
s.SetFlash("name", "iris")
|
||||
ctx.Writef("Message setted, is available for the next request")
|
||||
})
|
||||
|
||||
app.Get("/get", func(ctx context.Context) {
|
||||
app.Get("/get", func(ctx iris.Context) {
|
||||
s := sess.Start(ctx)
|
||||
name := s.GetFlashString("name")
|
||||
if name == "" {
|
||||
@@ -27,7 +26,7 @@ func main() {
|
||||
ctx.Writef("Hello %s", name)
|
||||
})
|
||||
|
||||
app.Get("/test", func(ctx context.Context) {
|
||||
app.Get("/test", func(ctx iris.Context) {
|
||||
s := sess.Start(ctx)
|
||||
name := s.GetFlashString("name")
|
||||
if name == "" {
|
||||
|
||||
Reference in New Issue
Block a user