Documentation
¶
Index ¶
Constants ¶
View Source
const ( KeySessionTokenMessage = "authenticatedTokenMessage" KeySessionFlash = "flash" KeySessionRedirectPath = "redirectPathAfterLogin" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Application ¶
type Application struct {
DebugOn bool
ErrorLog *log.Logger
InfoLog *log.Logger
Session *sessions.Session
TemplateCache map[string]*template.Template
Snippets models.APISnippets
Users models.APIUsers
}
Application Define a struct to hold the application-wide dependencies for the web application. This will allow us to make the objects available to our handlers.
func (*Application) Routes ¶
func (app *Application) Routes() http.Handler
Update the signature for the routes() method so that it returns a http.Handler instead of *http.ServeMux.
type TemplateData ¶
type TemplateData struct {
CSRFToken string
CurrentYear int
Flash string
Form *forms.Form
IsAuthenticated bool
IsAdmin bool
LoggedInName string
ID int
Snippet *models.Snippet
Snippets []*models.Snippet
User *models.User
Users []*models.User
Roles []*models.RoleType
}
Define a templateData type to act as the holding structure for any dynamic data that we want to pass to our HTML templates.
Click to show internal directories.
Click to hide internal directories.