These are chat archives for gin-gonic/gin

19th
Jul 2017
Phillipp Schmedt
@phillippschmedt
Jul 19 2017 07:21
@krypton97 Was that a response to my question?
[GIN-debug] Loaded HTML Templates (5):
- header
- index.tmpl
-
- footer.tmpl
- header.tmpl
Why is gin loading 5 templates? including an "empty" one here?
I ony have the .tmpl files
in my templates directory
Thomas Boerger
@tboerger
Jul 19 2017 07:22
router.LoadHTMLGlob("templates/*.tmpl") should be better
Phillipp Schmedt
@phillippschmedt
Jul 19 2017 08:22
@tboerger Any idea why it loads an empty template for me?
Phillipp Schmedt
@phillippschmedt
Jul 19 2017 08:39
How can I access the Session? I want to add flash messages
Phillipp Schmedt
@phillippschmedt
Jul 19 2017 08:45
Oh I guess I need to add the github.com/gin-contrib/sessions middleware first?
Phillipp Schmedt
@phillippschmedt
Jul 19 2017 09:34
I love gin.
unreadable
@unreadable
Jul 19 2017 14:05
I like to keep the extension .hbs to get the icon file
Phillipp Schmedt
@phillippschmedt
Jul 19 2017 23:03
Has anyone used flash messages yet? For some reason my Session.Flashes() is empty on the next call
    session := sessions.Default(c)
    session.AddFlash(voucherData.Name, "voucher")
    c.Redirect(303, "/confirmPage")
session := sessions.Default(c)
    flashes := session.Flashes("voucher")
    fmt.Println(flashes)
It's empty on the second
Phillipp Schmedt
@phillippschmedt
Jul 19 2017 23:21
ok works now. I didn't know i need to call save() after Flashes() and AddFlash()
Why is it even necessary to call save()?