Documentation ¶
Index ¶
- Constants
- func CreateHttpBuilder(routerConfig func(router router.IRouterBuilder)) *abstractions.HostBuilder
- func CreateMvcBuilder(appFunc func(app *ApplicationBuilder)) *abstractions.HostBuilder
- func NewFastHTTPHandler(h http.Handler) fasthttp.RequestHandler
- func Upgrade(ctx *context.HttpContext, upgraderFunc func(*websocket.Conn))
- func UpgradeHandler(upgraderFunc func(*websocket.Conn)) func(ctx *context.HttpContext)
- type ApplicationBuilder
- func (this *ApplicationBuilder) Build() interface{}
- func (app *ApplicationBuilder) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (this *ApplicationBuilder) SetHostBuildContext(context *abstractions.HostBuilderContext)
- func (self *ApplicationBuilder) SetJsonSerializer(encoder extension.Encoder) *ApplicationBuilder
- func (app *ApplicationBuilder) Use(provider interface{})
- func (self *ApplicationBuilder) UseEndpoints(configure func(router.IRouterBuilder)) *ApplicationBuilder
- func (app *ApplicationBuilder) UseFunc(handlerFunc middlewares.MiddlewareHandlerFunc)
- func (app *ApplicationBuilder) UseHandler(handler http.Handler)
- func (app *ApplicationBuilder) UseHandlerFunc(handlerFunc func(rw http.ResponseWriter, r *http.Request))
- func (app *ApplicationBuilder) UseMiddleware(handler middlewares.MiddlewareHandler)
- func (app *ApplicationBuilder) UseMiddlewareFront(handler middlewares.MiddlewareHandler)
- func (self *ApplicationBuilder) UseMvc(configure func(builder *mvc.ControllerBuilder)) *ApplicationBuilder
- func (app *ApplicationBuilder) UseStatic(patten string, path string)
- func (app *ApplicationBuilder) UseStaticAssets()
- type FastHttpServer
- type HandlerFunc
- type HttpServer
- type IRequestDelegate
- type NetHTTPResponseWriter
- type WebHost
- type WebHostBuilder
- type WebHostBuilderDecorator
- func (decorator WebHostBuilderDecorator) OverrideConfigure(configureFunc interface{}, builder abstractions.IApplicationBuilder)
- func (decorator WebHostBuilderDecorator) OverrideIOCInnerConfigures(serviceCollection *dependencyinjection.ServiceCollection)
- func (decorator WebHostBuilderDecorator) OverrideNewApplicationBuilder(context *abstractions.HostBuilderContext) abstractions.IApplicationBuilder
- func (decorator WebHostBuilderDecorator) OverrideNewHost(server abstractions.IServer, context *abstractions.HostBuilderContext) abstractions.IServiceHost
Constants ¶
const (
// DefaultAddress is used if no other is specified.
DefaultAddress = ":8080"
)
Variables ¶
This section is empty.
Functions ¶
func CreateHttpBuilder ¶ added in v1.6.1
func CreateHttpBuilder(routerConfig func(router router.IRouterBuilder)) *abstractions.HostBuilder
region Create the builder of Web host
func CreateMvcBuilder ¶ added in v1.6.1
func CreateMvcBuilder(appFunc func(app *ApplicationBuilder)) *abstractions.HostBuilder
func NewFastHTTPHandler ¶ added in v1.6.4
func NewFastHTTPHandler(h http.Handler) fasthttp.RequestHandler
func Upgrade ¶ added in v1.6.4
func Upgrade(ctx *context.HttpContext, upgraderFunc func(*websocket.Conn))
serveWs handles socket requests from the peer.
func UpgradeHandler ¶ added in v1.6.4
func UpgradeHandler(upgraderFunc func(*websocket.Conn)) func(ctx *context.HttpContext)
Types ¶
type ApplicationBuilder ¶ added in v1.6.1
type ApplicationBuilder struct {
// contains filtered or unexported fields
}
application builder struct
func New ¶
func New(handlers ...middlewares.MiddlewareHandler) *ApplicationBuilder
create application builder when combo all handlers to middleware
func NewWebApplicationBuilder ¶
func NewWebApplicationBuilder() *ApplicationBuilder
create new web application builder
func (*ApplicationBuilder) Build ¶ added in v1.6.1
func (this *ApplicationBuilder) Build() interface{}
build and combo all middleware to request delegate (ServeHTTP(w http.ResponseWriter, r *http.Request)) return abstractions.IRequestDelegate type
func (*ApplicationBuilder) ServeHTTP ¶ added in v1.6.1
func (app *ApplicationBuilder) ServeHTTP(w http.ResponseWriter, r *http.Request)
middlewares of Server MiddlewareHandler , request port.
func (*ApplicationBuilder) SetHostBuildContext ¶ added in v1.6.1
func (this *ApplicationBuilder) SetHostBuildContext(context *abstractions.HostBuilderContext)
func (*ApplicationBuilder) SetJsonSerializer ¶ added in v1.6.1
func (self *ApplicationBuilder) SetJsonSerializer(encoder extension.Encoder) *ApplicationBuilder
SetJsonSerializer set json serializer for response
func (*ApplicationBuilder) Use ¶ added in v1.6.2
func (app *ApplicationBuilder) Use(provider interface{})
func (*ApplicationBuilder) UseEndpoints ¶ added in v1.6.1
func (self *ApplicationBuilder) UseEndpoints(configure func(router.IRouterBuilder)) *ApplicationBuilder
func (*ApplicationBuilder) UseFunc ¶ added in v1.6.1
func (app *ApplicationBuilder) UseFunc(handlerFunc middlewares.MiddlewareHandlerFunc)
apply handler func middleware in builder
func (*ApplicationBuilder) UseHandler ¶ added in v1.6.1
func (app *ApplicationBuilder) UseHandler(handler http.Handler)
apply handler middleware in builder
func (*ApplicationBuilder) UseHandlerFunc ¶ added in v1.6.1
func (app *ApplicationBuilder) UseHandlerFunc(handlerFunc func(rw http.ResponseWriter, r *http.Request))
apply handler func middleware in builder
func (*ApplicationBuilder) UseMiddleware ¶ added in v1.6.1
func (app *ApplicationBuilder) UseMiddleware(handler middlewares.MiddlewareHandler)
apply middleware in builder
func (*ApplicationBuilder) UseMiddlewareFront ¶ added in v1.6.2
func (app *ApplicationBuilder) UseMiddlewareFront(handler middlewares.MiddlewareHandler)
apply middleware in builder
func (*ApplicationBuilder) UseMvc ¶ added in v1.6.1
func (self *ApplicationBuilder) UseMvc(configure func(builder *mvc.ControllerBuilder)) *ApplicationBuilder
UseMvc after create builder , apply router and logger and recovery middleware
func (*ApplicationBuilder) UseStatic ¶ added in v1.6.1
func (app *ApplicationBuilder) UseStatic(patten string, path string)
apply static middleware in builder
func (*ApplicationBuilder) UseStaticAssets ¶ added in v1.6.1
func (app *ApplicationBuilder) UseStaticAssets()
type FastHttpServer ¶
type FastHttpServer struct { IsTLS bool Addr, CertFile, KeyFile string // contains filtered or unexported fields }
func NewFastHttp ¶
func NewFastHttp(addr string) *FastHttpServer
func NewFastHttpByConfig ¶ added in v1.6.1
func NewFastHttpByConfig(config hostenv.HttpServerConfig) *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.HostBuilderContext) (e error)
func (*FastHttpServer) Shutdown ¶
func (server *FastHttpServer) Shutdown()
type HandlerFunc ¶
type HandlerFunc = func(ctx *context.HttpContext)
func WarpHandlerFunc ¶
func WarpHandlerFunc(h func(w http.ResponseWriter, r *http.Request)) HandlerFunc
func WarpHttpHandlerFunc ¶
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 NewDefaultHttpByConfig ¶ added in v1.6.1
func NewDefaultHttpByConfig(config hostenv.HttpServerConfig) *HttpServer
func (*HttpServer) GetAddr ¶
func (server *HttpServer) GetAddr() string
func (*HttpServer) Run ¶
func (server *HttpServer) Run(context *abstractions.HostBuilderContext) (e error)
func (*HttpServer) Shutdown ¶
func (server *HttpServer) Shutdown()
type IRequestDelegate ¶
type IRequestDelegate interface {
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
type NetHTTPResponseWriter ¶ added in v1.6.4
type NetHTTPResponseWriter struct { Ctx *fasthttp.RequestCtx IsHijackerConn bool // contains filtered or unexported fields }
func (*NetHTTPResponseWriter) Header ¶ added in v1.6.4
func (w *NetHTTPResponseWriter) Header() http.Header
func (*NetHTTPResponseWriter) StatusCode ¶ added in v1.6.4
func (w *NetHTTPResponseWriter) StatusCode() int
func (*NetHTTPResponseWriter) Write ¶ added in v1.6.4
func (w *NetHTTPResponseWriter) Write(p []byte) (int, error)
func (*NetHTTPResponseWriter) WriteHeader ¶ added in v1.6.4
func (w *NetHTTPResponseWriter) WriteHeader(statusCode int)
type WebHost ¶
type WebHost struct { HostContext *abstractions.HostBuilderContext // contains filtered or unexported fields }
func NewWebHost ¶
func NewWebHost(server abstractions.IServer, hostContext *abstractions.HostBuilderContext) WebHost
func (WebHost) SetAppMode ¶
func (WebHost) StopApplicationNotify ¶
func (host WebHost) StopApplicationNotify()
type WebHostBuilder ¶
type WebHostBuilder struct {
abstractions.HostBuilder
}
func CreateBlankWebBuilder ¶
func CreateBlankWebBuilder() *WebHostBuilder
func NewWebHostBuilder ¶
func NewWebHostBuilder() *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) OverrideIOCInnerConfigures ¶ added in v1.6.1
func (decorator WebHostBuilderDecorator) OverrideIOCInnerConfigures(serviceCollection *dependencyinjection.ServiceCollection)
OverrideInnerConfigures inner configures for IOC
func (WebHostBuilderDecorator) OverrideNewApplicationBuilder ¶
func (decorator WebHostBuilderDecorator) OverrideNewApplicationBuilder(context *abstractions.HostBuilderContext) abstractions.IApplicationBuilder
OverrideNewApplicationBuilder create web application builder.
func (WebHostBuilderDecorator) OverrideNewHost ¶
func (decorator WebHostBuilderDecorator) OverrideNewHost(server abstractions.IServer, context *abstractions.HostBuilderContext) abstractions.IServiceHost
OverrideNewHost Create WebHost.