Documentation
¶
Rendered for js/wasm
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
Handle registers fn as the single request handler and blocks forever. fn is called for every incoming HTTP request to the Worker. This must be called from main(); it never returns.
Uses the binding pattern from goflare/assets/worker.mjs:
binding.handleRequest is called per request with the JS Request object.
binding is accessed via js.Global().Get("context") — injected by wasm_exec.js Proxy.
Types ¶
type Request ¶
type Request struct {
Method string
URL string
Headers map[string]string
// contains filtered or unexported fields
}
Request represents an incoming HTTP request to the Worker.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is written by the handler and converted to a JS Response.
func (*Response) Header ¶
Header returns the response headers map for setting values. Usage: w.Header()["Content-Type"] = "application/json"
func (*Response) WriteHeader ¶
WriteHeader sets the HTTP status code.
Click to show internal directories.
Click to hide internal directories.