kernel

package
v0.1.0-alpha Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Declaring base controller
	BaseController controller.BaseController
	// Register web router
	Router = WebRouter()
	// Get app configuration
	Configuration = config.Configuration()
	// Register all models
	Models = []interface{}{
		model.User{},
		model.FailedJob{},
	}
	// Register all controllers. Every controller must be implemented as a pointer to struct.
	// See the basic implementation to see the correct way to register a new controller.
	Controllers = []interface{}{
		&controller.UserController{},
		&controller.AuthController{},
		&controller.HomeController{},
	}
	// Register service container
	Container *dig.Container
)

Functions

func GetControllerInterface

func GetControllerInterface(directive []string, w http.ResponseWriter, r *http.Request) interface{}

Returns a specific controller instance by comparing "directive" parameter with controller name.

func WebRouter

func WebRouter() *mux.Router

Parse routing structures and set every route. Return a Gorilla Mux router instance with all routes indicated in router.yml file.

Types

type HttpKernel

type HttpKernel struct {
	Models    []interface{}
	Container *dig.Container
}

func StartKernel

func StartKernel() *HttpKernel

Return an HTTP kernel instance.

Jump to

Keyboard shortcuts

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