Documentation ¶
Index ¶
- func New(ctx context.Context, db db.DB, r *redis.Client, lMod *language.Module) (web.Module, error)
- type ErrorPageTemplate
- type Module
- func (m *Module) HomeGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) LoginGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) LoginPostHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) LogoutGetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Module) Middleware(next http.Handler) http.Handler
- func (m *Module) MiddlewareRequireAuth(next http.Handler) http.Handler
- func (m *Module) Name() string
- func (m *Module) Route(s web.Server) error
- type ResponseWriterX
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorPageTemplate ¶
type ErrorPageTemplate struct { template2.Common BotImage string Header string SubHeader string Paragraph string ButtonHRef string ButtonLabel string }
ErrorPageTemplate contains the variables for the "error" template.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module contains a webapp module for the web server. Implements web.Module
func (*Module) HomeGetHandler ¶
func (m *Module) HomeGetHandler(w http.ResponseWriter, r *http.Request)
HomeGetHandler serves the home page
func (*Module) LoginGetHandler ¶
func (m *Module) LoginGetHandler(w http.ResponseWriter, r *http.Request)
LoginGetHandler serves the login page
func (*Module) LoginPostHandler ¶
func (m *Module) LoginPostHandler(w http.ResponseWriter, r *http.Request)
LoginPostHandler attempts a login
func (*Module) LogoutGetHandler ¶
func (m *Module) LogoutGetHandler(w http.ResponseWriter, r *http.Request)
LogoutGetHandler logs a user out
func (*Module) Middleware ¶
Middleware runs on every http request
func (*Module) MiddlewareRequireAuth ¶
MiddlewareRequireAuth will redirect a user to login page if user not in context
type ResponseWriterX ¶
type ResponseWriterX struct { http.ResponseWriter // contains filtered or unexported fields }
ResponseWriterX is a ResponseWriter that keeps track of status and body size
func (*ResponseWriterX) Write ¶
func (r *ResponseWriterX) Write(b []byte) (int, error)
Write to the response writer, also updating body length
func (*ResponseWriterX) WriteHeader ¶
func (r *ResponseWriterX) WriteHeader(status int)
WriteHeader sets the status of the response
Click to show internal directories.
Click to hide internal directories.