mirror of
https://github.com/cubixle/tuu.git
synced 2026-04-24 23:04:43 +01:00
made session, flash, work(ish)
This commit is contained in:
20
route.go
20
route.go
@@ -3,24 +3,28 @@ package tuu
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/sessions"
|
||||
|
||||
gcontext "github.com/gorilla/context"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type Route struct {
|
||||
Method string
|
||||
Path string
|
||||
Handler Handler
|
||||
Env string
|
||||
Middleware MiddlewareStack
|
||||
Logger *logrus.Logger
|
||||
app *App
|
||||
Method string
|
||||
Path string
|
||||
Handler Handler
|
||||
Env string
|
||||
Middleware MiddlewareStack
|
||||
Logger *logrus.Logger
|
||||
Session sessions.Store
|
||||
SessionName string
|
||||
}
|
||||
|
||||
func (r *Route) ServeHTTP(res http.ResponseWriter, req *http.Request) {
|
||||
defer gcontext.Clear(req)
|
||||
|
||||
c := r.app.newContext(*r, res, req)
|
||||
c := newContext(*r, res, req)
|
||||
defer c.Flash().persist(c.Session())
|
||||
|
||||
err := r.Middleware.handler(r)(c)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user