core

package
v0.0.0-...-b600975 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config *viper.Viper

Config wraps viper so we don't have snakes all over our app

View Source
var Logger = logrus.New()

Logger wraps a logrus Logger to provide a common logging config

View Source
var Router = mux.NewRouter()

Router wraps the Gorilla mux so we don't have apes all over our app

View Source
var Static = packr.NewBox("../resources/static")

Static wraps packr and handled embedding the /static files in the executable

View Source
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

func ConfigureLogger(config *viper.Viper)

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

func ConfigureStatic(static packr.Box)

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

type ServerConfig

type ServerConfig struct {
	Port         string
	Address      string
	WriteTimeout time.Duration
	ReadTimeout  time.Duration
}

ServerConfig represents http Server configuration properties

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL