1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00
Former-commit-id: f2f277cd5cbe781ce596adc7840a1b1bc3b3bfc6
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-06-19 05:54:21 +03:00
parent 9724592697
commit 3f98b39632
6 changed files with 61 additions and 31 deletions

View File

@@ -36,9 +36,11 @@ func NewApp(sess *sessions.Sessions) *iris.Application {
// set session values.
app.Get("/set", func(ctx iris.Context) {
session := sessions.Get(ctx)
isNew := session.IsNew()
session.Set("name", "iris")
ctx.Writef("All ok session set to: %s", session.GetString("name"))
ctx.Writef("All ok session set to: %s [isNew=%t]", session.GetString("name"), isNew)
})
app.Get("/get", func(ctx iris.Context) {
@@ -68,9 +70,11 @@ func NewApp(sess *sessions.Sessions) *iris.Application {
key := ctx.Params().Get("key")
value := ctx.Params().Get("value")
isNew := session.IsNew()
session.Set(key, value)
ctx.Writef("All ok session value of the '%s' is: %s", key, session.GetString(key))
ctx.Writef("All ok session value of the '%s' is: %s [isNew=%t]", key, session.GetString(key), isNew)
})
app.Get("/get/{key}", func(ctx iris.Context) {