bootstrap

package
v0.0.0-...-3f42f3c Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootstrapper

type Bootstrapper struct {
	//内置继承iris类
	*iris.Application

	//两个基本的标识信息
	AppName  string
	AppOwner string
	//创建时间
	AppSpawnDate time.Time
}

Bootstrapper 使用Go内建的嵌入机制(匿名嵌入),允许类型之前共享代码和数据 (Bootstrapper继承和共享 iris.Application ) 参考文章: https://hackthology.com/golangzhong-de-mian-xiang-dui-xiang-ji-cheng.html

func New

func New(appName, appOwner string, cfgs ...Configurator) *Bootstrapper

New returns a new Bootstrapper. 实例化 cfgs ...Configurator更多参数

func (*Bootstrapper) Bootstrap

func (b *Bootstrapper) Bootstrap() *Bootstrapper

Bootstrap prepares our application. Returns itself. 初始化

func (*Bootstrapper) Configure

func (b *Bootstrapper) Configure(cs ...Configurator)

Configure accepts configurations and runs them inside the Bootstraper's context. 给web的配置方法

func (*Bootstrapper) Listen

func (b *Bootstrapper) Listen(addr string, cfgs ...iris.Configurator)

Listen starts the http server with the specified "addr". 监听

func (*Bootstrapper) SetupErrorHandlers

func (b *Bootstrapper) SetupErrorHandlers()

异常处理

func (*Bootstrapper) SetupViews

func (b *Bootstrapper) SetupViews(viewsDir string)

SetupViews loads the templates. 初始化模板 传入一个目录

type Configurator

type Configurator func(bootstrapper *Bootstrapper)

Configurator 定义配置器 类型是func

Jump to

Keyboard shortcuts

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