gernest / utron

A lightweight MVC framework for Go(Golang)
MIT License
2.22k stars 149 forks source link

Use of sessions #60

Closed eullerpereira94 closed 8 years ago

eullerpereira94 commented 8 years ago

There was I, just browsing some code at Github, when I decided to read Utron's wiki. Then I stumbled upon the middlewares' page, and a doubt was spawned in my head: how the heck I would use this?Do I just have to follow the Gorilla tutorial, or make use of some gimmick to achieve that?

gernest commented 8 years ago

Do you have any suggestions on what should be a good way?

eullerpereira94 commented 8 years ago

That's my problem, I'm ashamed to say that I am totally clueless about it. It just amazes me by how long it took for me to realize this. The text written by @Slacki in the wiki show that this could be done through middlewares, but also, I've never ever even had done that before(I am the type doesn't study something if I'm not intending to use). Actually, I'm working in HTTPS support for utron in my free time, so I can't look at that right now, but maybe I can take a shot at it.

gernest commented 8 years ago

@euller88 great to hear you are on http support. No need to rush, one thing at a time. Thanks.

slacki commented 8 years ago

@euller88 Well, that is my approach. I am newbie to utron and golang itself, so it may be totally wrong and maybe I made a fool of myself. The point was to just do something with session wherever I need sessions (i register this middleware in the controllers I am using sessions in).

eullerpereira94 commented 8 years ago

Well, since utron uses a singleton(cough, cough, baseApp) to handle the whole thing, I think that a general session manager should work, then each controller should create or end one session, and modify it. This is the first idea I had after stopping to think a little

OsvaldoTCF commented 8 years ago

perhaps http://www.alexedwards.net/blog/making-and-using-middleware