Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Config *viper.Viper
Config wraps viper so we don't have snakes all over our app
var Logger = logrus.New()
Logger wraps a logrus Logger to provide a common logging config
var Router = mux.NewRouter()
Router wraps the Gorilla mux so we don't have apes all over our app
var Static = packr.NewBox("../resources/static")
Static wraps packr and handled embedding the /static files in the executable
var Templates = packr.NewBox("../../resources/templates")
Templates wraps packr and handled embedding the /static files in the executable
Functions ¶
func AttachRouter ¶
func AttachRouter(path string)
AttachRouter attached the handler to a specified path
func ConfigureControllers ¶
func ConfigureControllers(controllers []Controller)
ConfigureControllers registers an array of controllers to the router
func ConfigureLogger ¶
ConfigureLogger sets up the log level based on a Viper config
func ConfigureMiddleware ¶
func ConfigureMiddleware(middleware []mux.MiddlewareFunc)
ConfigureMiddleware registers an array of middleware to the router
func ConfigureStatic ¶
ConfigureStatic takes a packr.Box to use for /static/ path assets
func InitConfig ¶
func InitConfig()
InitConfig inits the global config. Use core.Config to access values
Types ¶
type Controller ¶
type Controller struct { Name string Path string Handler http.HandlerFunc }
Controller wraps an http.Handler with extra details about name and path