Documentation ¶
Overview ¶
Package web interacts with frontend.
Index ¶
Constants ¶
View Source
const (
// RequestIDHeader is the field name for request ID header.
RequestIDHeader = "Request-Id"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextAdapter ¶
type ContextAdapter struct {
// contains filtered or unexported fields
}
ContextAdapter wraps context handler.
func (*ContextAdapter) ServeHTTP ¶
func (ca *ContextAdapter) ServeHTTP(w http.ResponseWriter, req *http.Request)
type ContextHandler ¶
type ContextHandler interface {
ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) error
}
ContextHandler handles ServeHTTP with context.
type ContextHandlerFunc ¶
ContextHandlerFunc defines HandlerFunc function signature to wrap context.
func (ContextHandlerFunc) ServeHTTPContext ¶
func (f ContextHandlerFunc) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, req *http.Request) error
ServeHTTPContext serve HTTP requests with context.
type Request ¶
type Request struct { DataFromFrontend string `json:"data_from_frontend"` CreateRequest bool `json:"create_request"` }
Request defines requests from frontend.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server warps http.Server.
func StartServer ¶
StartServer starts a backend webserver with stoppable listener.
func (*Server) StopNotify ¶
func (srv *Server) StopNotify() <-chan struct{}
StopNotify returns receive-only stop channel to notify the server has stopped.
Click to show internal directories.
Click to hide internal directories.