YoyoGo

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAddress is used if no other is specified.
	DefaultAddress = ":8080"
)

Variables

This section is empty.

Functions

func CreateDefaultBuilder

func CreateDefaultBuilder(routerConfig func(router Router.IRouterBuilder)) *Abstractions.HostBuilder

region Create the builder of Web host

Types

type FastHttpServer

type FastHttpServer struct {
	IsTLS                   bool
	Addr, CertFile, KeyFile string
	// contains filtered or unexported fields
}

func NewFastHttp

func NewFastHttp(addr string) *FastHttpServer

func NewFastHttps

func NewFastHttps(addr string, cert string, key string) FastHttpServer

func (*FastHttpServer) GetAddr

func (server *FastHttpServer) GetAddr() string

func (*FastHttpServer) Run

func (server *FastHttpServer) Run(context *Abstractions.HostBuildContext) (e error)

func (*FastHttpServer) Shutdown

func (server *FastHttpServer) Shutdown()

type HandlerFunc

type HandlerFunc = func(ctx *Context.HttpContext)

func WarpHandlerFunc added in v1.5.1

func WarpHandlerFunc(h func(w http.ResponseWriter, r *http.Request)) HandlerFunc

func WarpHttpHandlerFunc added in v1.5.1

func WarpHttpHandlerFunc(h http.Handler) HandlerFunc

type HttpServer

type HttpServer struct {
	IsTLS                   bool
	Addr, CertFile, KeyFile string
	// contains filtered or unexported fields
}

func DefaultHttpServer

func DefaultHttpServer(addr string) *HttpServer

func DefaultHttps

func DefaultHttps(addr string, cert string, key string) *HttpServer

func (*HttpServer) GetAddr

func (server *HttpServer) GetAddr() string

func (*HttpServer) Run

func (server *HttpServer) Run(context *Abstractions.HostBuildContext) (e error)

func (*HttpServer) Shutdown

func (server *HttpServer) Shutdown()

type IRequestDelegate added in v1.5.6

type IRequestDelegate interface {
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

type MiddlewareHandler added in v1.5.2

type MiddlewareHandler interface {
	Inovke(ctx *Context.HttpContext, next func(ctx *Context.HttpContext))
}

type MiddlewareHandlerFunc added in v1.5.1

type MiddlewareHandlerFunc func(ctx *Context.HttpContext, next func(ctx *Context.HttpContext))

func (MiddlewareHandlerFunc) Inovke added in v1.5.1

func (h MiddlewareHandlerFunc) Inovke(ctx *Context.HttpContext, next func(ctx *Context.HttpContext))

type NextFunc

type NextFunc func(ctx *Context.HttpContext)

type WebApplicationBuilder

type WebApplicationBuilder struct {
	// contains filtered or unexported fields
}

application builder struct

func New

func New(handlers ...MiddlewareHandler) *WebApplicationBuilder

create application builder when combo all handlers to middleware

func NewWebApplicationBuilder

func NewWebApplicationBuilder() *WebApplicationBuilder

create new web application builder

func UseClassic

func UseClassic() *WebApplicationBuilder

create classic application builder

func (*WebApplicationBuilder) Build

func (this *WebApplicationBuilder) Build() interface{}

build and combo all middleware to request delegate (ServeHTTP(w http.ResponseWriter, r *http.Request)) return Abstractions.IRequestDelegate type

func (*WebApplicationBuilder) ServeHTTP

func (app *WebApplicationBuilder) ServeHTTP(w http.ResponseWriter, r *http.Request)

Middleware of Server MiddlewareHandler , request port.

func (*WebApplicationBuilder) SetHostBuildContext

func (this *WebApplicationBuilder) SetHostBuildContext(context *Abstractions.HostBuildContext)

func (*WebApplicationBuilder) UseEndpoints

func (self *WebApplicationBuilder) UseEndpoints(configure func(Router.IRouterBuilder)) *WebApplicationBuilder

func (*WebApplicationBuilder) UseFunc

func (app *WebApplicationBuilder) UseFunc(handlerFunc MiddlewareHandlerFunc)

apply handler func middleware in builder

func (*WebApplicationBuilder) UseHandler

func (app *WebApplicationBuilder) UseHandler(handler http.Handler)

apply handler middleware in builder

func (*WebApplicationBuilder) UseHandlerFunc

func (app *WebApplicationBuilder) UseHandlerFunc(handlerFunc func(rw http.ResponseWriter, r *http.Request))

apply handler func middleware in builder

func (*WebApplicationBuilder) UseMiddleware

func (app *WebApplicationBuilder) UseMiddleware(handler MiddlewareHandler)

apply middleware in builder

func (*WebApplicationBuilder) UseMvc

func (self *WebApplicationBuilder) UseMvc(configure func(builder *Mvc.ControllerBuilder)) *WebApplicationBuilder

UseMvc after create builder , apply router and logger and recovery middleware

func (*WebApplicationBuilder) UseStatic

func (app *WebApplicationBuilder) UseStatic(patten string, path string)

apply static middleware in builder

func (*WebApplicationBuilder) UseStaticAssets added in v1.5.1

func (app *WebApplicationBuilder) UseStaticAssets()

type WebHost

type WebHost struct {
	HostContext *Abstractions.HostBuildContext
	// contains filtered or unexported fields
}

func NewWebHost

func NewWebHost(server Abstractions.IServer, hostContext *Abstractions.HostBuildContext) WebHost

func (WebHost) Run

func (host WebHost) Run()

func (WebHost) SetAppMode

func (host WebHost) SetAppMode(mode string)

func (WebHost) Shutdown

func (host WebHost) Shutdown()

Shutdown is Graceful stop application

func (WebHost) StopApplicationNotify

func (host WebHost) StopApplicationNotify()

type WebHostBuilder

type WebHostBuilder struct {
	Abstractions.HostBuilder
}

func CreateBlankWebBuilder added in v1.5.1

func CreateBlankWebBuilder() *WebHostBuilder

func NewWebHostBuilder

func NewWebHostBuilder() *WebHostBuilder

func (*WebHostBuilder) SetEnvironment

func (host *WebHostBuilder) SetEnvironment(mode string) *WebHostBuilder

SetEnvironment set value(Dev,Test,Prod) by environment

func (*WebHostBuilder) UseFastHttp

func (host *WebHostBuilder) UseFastHttp() *WebHostBuilder

func (*WebHostBuilder) UseFastHttpByAddr

func (host *WebHostBuilder) UseFastHttpByAddr(addr string) *WebHostBuilder

func (*WebHostBuilder) UseHttp

func (host *WebHostBuilder) UseHttp() *WebHostBuilder

func (*WebHostBuilder) UseHttpByAddr

func (host *WebHostBuilder) UseHttpByAddr(addr string) *WebHostBuilder

type WebHostBuilderDecorator

type WebHostBuilderDecorator struct {
}

func NewWebHostBuilderDecorator

func NewWebHostBuilderDecorator() WebHostBuilderDecorator

NewWebHostBuilderDecorator WebHostBuilderDecorator.

func (WebHostBuilderDecorator) OverrideConfigure

func (decorator WebHostBuilderDecorator) OverrideConfigure(configureFunc interface{}, builder Abstractions.IApplicationBuilder)

OverrideConfigure is configure function by web application builder.

func (WebHostBuilderDecorator) OverrideNewApplicationBuilder

func (decorator WebHostBuilderDecorator) OverrideNewApplicationBuilder(context *Abstractions.HostBuildContext) Abstractions.IApplicationBuilder

OverrideNewApplicationBuilder create web application builder.

func (WebHostBuilderDecorator) OverrideNewHost

OverrideNewHost Create WebHost.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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