Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct { Router *router.Router Config *config.Config View view.View Log logger.Logger Model *models.Model ConfigPath string StaticServer StaticServerFunc SessionStore sessions.Store // contains filtered or unexported fields }
App is the main utron application.
func NewApp ¶
func NewApp() *App
NewApp creates a new bare-bone utron application. To use the MVC components, you should call the Init method before serving requests.
func NewMVC ¶
NewMVC creates a new MVC utron app. If cfg is passed, it should be a directory to look for the configuration files. The App returned is initialized.
func (*App) AddController ¶
func (a *App) AddController(ctrlfn func() controller.Controller, middlewares ...interface{})
AddController registers a controller, and middlewares if any is provided.
func (*App) ServeHTTP ¶
func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves http requests. It can be used with other http.Handler implementations.
func (*App) SetConfigPath ¶
SetConfigPath sets the directory path to search for the config files.
type StaticServerFunc ¶
StaticServerFunc is a function that returns the static assetsfiles server.
The first argument retrued is the path prefix for the static assets. If strp is set to true then the prefix is going to be stripped.