Documentation ¶
Index ¶
- Constants
- type Bootstrapper
- func (b *Bootstrapper) Bootstrap() *Bootstrapper
- func (b *Bootstrapper) Configure(cs ...Configurator)
- func (b *Bootstrapper) Listen(addr string, cfgs ...iris.Configurator)
- func (b *Bootstrapper) SetupErrorHandlers()
- func (b *Bootstrapper) SetupSessions(expires time.Duration, cookieHashKey, cookieBlockKey []byte)
- func (b *Bootstrapper) SetupViews(viewsDir string)
- type Configurator
Constants ¶
View Source
const ( // StaticAssets is the root directory for public assets like images, css, js. StaticAssets = "./web/public/" // Favicon is the relative 9to the "StaticAssets") favicon path for our app. Favicon = "favicon.ico" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bootstrapper ¶
type Bootstrapper struct { *iris.Application AppName string AppOwner string AppSpawnDate time.Time Sessions *sessions.Sessions }
使用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.
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.
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()
SetupErrorHandlers prepares the http error handlers `(context.StatusCodeNotSuccessful`, which defaults to < 200 || >= 400 but you can change it).
func (*Bootstrapper) SetupSessions ¶
func (b *Bootstrapper) SetupSessions(expires time.Duration, cookieHashKey, cookieBlockKey []byte)
SetupSessions initializes the sessions, optionally.
func (*Bootstrapper) SetupViews ¶
func (b *Bootstrapper) SetupViews(viewsDir string)
SetupViews loads the templates.
type Configurator ¶
type Configurator func(*Bootstrapper)
Click to show internal directories.
Click to hide internal directories.