Routing nodes
Route — express.route
Defines an HTTP route and attaches a Handler Function to it.
- Inputs:
in— "App" - Outputs:
out— "Handler" - Config fields:
| Key | Type | Default | Notes |
|---|---|---|---|
method | select | GET | One of GET, POST, PUT, DELETE, PATCH. |
path | text | / |
- Constraints: the "Handler" output must be wired to a Handler Function node — an unattached Route, or one wired to anything else, fails compilation with a clear error naming the route. Chain additional Handler Functions off the first one's "Next" output to register more than one on the same route.
A Route has no "Async Handler" setting of its own — enable Async Handler on the Handler Function(s) it's attached to instead (see the npm Package Require example).
function handler(req, res, next) {
res.status(200).json({ message: "Hello World" });
}
app.get("/hello", handler);
Wiring a chain of Handler Functions — Route → Handler Function A → Handler Function B
— compiles to app.get(path, handlerA, handlerB), with each handler declared separately
above; every handler but the last must call next() in its body to reach the next one.
See the Logic reference
for the Handler Function node itself.