Documentation ¶
Index ¶
- Constants
- type Application
- func (application *Application) ApplyAuth(c *web.C, h http.Handler) http.Handler
- func (application *Application) ApplyDatabase(c *web.C, h http.Handler) http.Handler
- func (application *Application) ApplyProtectionFromCSRF(c *web.C, h http.Handler) http.Handler
- func (application *Application) ApplySessions(c *web.C, h http.Handler) http.Handler
- func (application *Application) ApplyTemplates(c *web.C, h http.Handler) http.Handler
- func (application *Application) Close()
- func (application *Application) ConnectToDatabase()
- func (application *Application) Init(filename *string)
- func (application *Application) LoadTemplates() error
- func (application *Application) Route(controller interface{}, route string, protected int) interface{}
- type Configuration
- type ConfigurationAWS
- type ConfigurationDatabase
- type Controller
Constants ¶
const ( // RouteProtected means the user has to have logged in in order to access this route RouteProtected = 1 // RoutePublic means this route is publicly accessible (no need for a log in) RoutePublic = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { Configuration *Configuration Template *template.Template Store *sessions.CookieStore DBSession *gorp.DbMap }
Application holds our app's global variables
func (*Application) ApplyAuth ¶
ApplyAuth makes sure controllers can check if the user is authorized
func (*Application) ApplyDatabase ¶
ApplyDatabase makes sure controllers can have access to the database
func (*Application) ApplyProtectionFromCSRF ¶
ApplyProtectionFromCSRF makes all POST messages check for a csrf_token
func (*Application) ApplySessions ¶
ApplySessions makes sure controllers can have access to session
func (*Application) ApplyTemplates ¶
ApplyTemplates makes sure templates are stored in the context
func (*Application) Close ¶
func (application *Application) Close()
Close cleans up anything nicely before exiting the process
func (*Application) ConnectToDatabase ¶
func (application *Application) ConnectToDatabase()
ConnectToDatabase initializes our database connection
func (*Application) Init ¶
func (application *Application) Init(filename *string)
Init initializes our globals
func (*Application) LoadTemplates ¶
func (application *Application) LoadTemplates() error
LoadTemplates initializes the template engine
func (*Application) Route ¶
func (application *Application) Route(controller interface{}, route string, protected int) interface{}
Route defines a web route
type Configuration ¶
type Configuration struct { Environment string `json:"environment"` ListeningPort string `json:"listening_port"` Secret string `json:"secret"` // Secret value for crypto of cookies. Change this periodically. PublicPath string `json:"public_path"` // Public web files TemplatePath string `json:"template_path"` // Template directory (the views) BaseURL string `json:"base_url"` // In production this is "https://app.summitroute.com" Database ConfigurationDatabase `json:"database"` Aws ConfigurationAWS `json:"aws"` }
Configuration is the main structure of our config.json file
func (*Configuration) Load ¶
func (configuration *Configuration) Load(filename string) (err error)
Load parses our configuration file
func (*Configuration) Parse ¶
func (configuration *Configuration) Parse(data []byte) (err error)
Parse parses the configuration file into a structure
type ConfigurationAWS ¶
ConfigurationAWS is a sub-element of Configuration
type ConfigurationDatabase ¶
type ConfigurationDatabase struct {
ConnectionString string `json:"connection_string"`
}
ConfigurationDatabase is a sub-element of Configuration
type Controller ¶
type Controller struct { }
Controller blah
func (*Controller) GetDatabase ¶
func (controller *Controller) GetDatabase(c web.C) *gorp.DbMap
GetDatabase blah
func (*Controller) GetSession ¶
func (controller *Controller) GetSession(c web.C) *sessions.Session
GetSession blah
func (*Controller) GetTemplate ¶
func (controller *Controller) GetTemplate(c web.C) *template.Template
GetTemplate blah