Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CookieComponent ¶
type CookieComponent struct{}
type Handler ¶
type Handler struct { // FileSystem to serve HTML components and other web assets from. FileSystem fs.FS // ComponentSearchPath is a list of directories in the FileSystem to search for CHTML components. // The list may contain absolute or relative paths. Relative paths are resolved // relative to the rendered component's path. // // If not set, the following default paths are used: // 1. "." (the directory of the rendered component) // 2. ".lib" (a directory named ".lib" in the directory of the rendered component) // 3. "/" (the root directory of the FileSystem) // 4. "/.lib" (a directory named ".lib" in the root directory of the FileSystem) ComponentSearchPath []string // CustomImporter is called to import user-defined components before looking in the FileSystem. // If CustomImporter returns chtml.ErrComponentNotFound, the default import process is used. CustomImporter chtml.Importer // BuiltinComponents is a map of built-in components that can be used in CHTML files. BuiltinComponents map[string]chtml.Component // OnError is a callback that is called when an error occurs while serving a page. OnError func(*http.Request, error) // OnErrorComponent is a name of a component that is rendered when an error occurs while // rendering a page. // This component is not invoked on general request processing errors where the OnError // callback can be used. // If not set, a standard "Internal Server Error" will be sent back to the client. OnErrorComponent string // Logger configures logging for internal events. Logger *slog.Logger // contains filtered or unexported fields }
type HttpCallArgs ¶
type HttpCallComponent ¶
type HttpCallComponent struct {
// contains filtered or unexported fields
}
HttpCallComponent implements a CHTML component for making HTTP requests and storing returned data in the scope.
func NewHttpCallComponent ¶
func NewHttpCallComponent(router http.Handler) *HttpCallComponent
func (*HttpCallComponent) Dispose ¶
func (c *HttpCallComponent) Dispose() error
type HttpCallResponse ¶
type HttpResponseComponent ¶
type HttpResponseComponent struct{}
type RequestArg ¶
type RequestArg struct { Method string `expr:"method"` URL string `expr:"url"` Host string `expr:"host"` Port string `expr:"port"` Scheme string `expr:"scheme"` Path string `expr:"path"` Query map[string][]string `expr:"query"` RemoteAddr string `expr:"remote_addr"` Headers map[string][]string `expr:"headers"` Cookies []*http.Cookie `expr:"cookies"` // Body is available only when the content type is either application/json or // application/x-www-form-urlencoded. Body map[string]any `expr:"body"` // RawBody is the Body field of the http.Request. If the content type is parseable as JSON or // form data, the RawBody will be closed. RawBody io.ReadCloser `expr:"raw_body"` }
RequestArg is a simplified model for http.Request suitable for expressions in templates.
func NewRequestArg ¶
func NewRequestArg(r *http.Request) *RequestArg
type RequestComponent ¶
type RequestComponent struct{}
type RouteComponent ¶
type RouteComponent struct{}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.