Documentation
¶
Overview ¶
Package flowhttp routes HTTP requests to the HTTP In nodes in a running flow.
The admin API and the editor are served by a plain http.ServeMux built once at start-up. Flow routes cannot be: they appear and disappear on every deploy, and ServeMux has no way to remove a pattern. So they live here, in a router the API server delegates to for anything the fixed routes did not claim.
Two rules that Node-RED does not have, both because the alternative fails quietly. A flow may not register a path that would shadow the editor or the admin API — the deploy is refused instead, because the symptom otherwise is an editor that stops loading with no explanation. And two nodes may not claim the same method and path; Express runs whichever matched first and the second node simply never fires.
Index ¶
Constants ¶
const MethodAny = ""
MethodAny matches any request method, which is Node-RED's "all".
Variables ¶
This section is empty.
Functions ¶
func RouteParams ¶
RouteParams reads back what WithRouteParams attached. An HTTP In node uses it to fill msg.req.params.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router holds the routes the flow's HTTP In nodes have registered.
func (*Router) Match ¶
Match finds the handler for a request, along with the path parameters it captured.
func (*Router) Register ¶
Register adds a route and returns the function that removes it again, which is what an HTTP In node calls on Close.
The method is one of the usual verbs, or MethodAny.