skeleton/internal/web/handlers.go
2019-05-14 14:11:03 +02:00

30 lines
539 B
Go

package web
import (
"net/http"
"github.com/alexedwards/scs"
"bitmask.me/skeleton/internal/app"
)
type Handlers struct {
*app.App
session *scs.Session
}
func NewHandlers(app *app.App) *Handlers {
h := &Handlers{App: app}
h.session = scs.NewSession()
h.session.Cookie.Persist = false
h.session.Cookie.Secure = false
return h
}
func (h *Handlers) Session() *scs.Session {
return h.session
}
func (h *Handlers) LandingPageHandler(w http.ResponseWriter, r *http.Request) {
h.Templates().Get("landing.tmpl").Execute(w, nil)
}