node-red/packages/node_modules/@node-red/nodes/examples/network/http/03 - Handle URL parameters....

135 lines
3.3 KiB
JSON

[
{
"id": "9b2d7459.8dd598",
"type": "http in",
"z": "d41b4dd3.ecd6a",
"name": "",
"url": "/hello-param/:name",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 290,
"y": 900,
"wires": [
[
"83753c80.5e271"
]
]
},
{
"id": "7fe50f46.46209",
"type": "http response",
"z": "d41b4dd3.ecd6a",
"name": "",
"statusCode": "",
"headers": {},
"x": 590,
"y": 900,
"wires": []
},
{
"id": "6e88d2b.828a92c",
"type": "comment",
"z": "d41b4dd3.ecd6a",
"name": "Handle URL parameters in an HTTP endpoint",
"info": "Named path parameters (e.g. `:name`) in the URL property can be used to identify parts of the path that can vary between requests.\n\nThe `msg.req.params` property is an object of key/value pairs for each path parameter.",
"x": 290,
"y": 860,
"wires": []
},
{
"id": "214bc398.b3482c",
"type": "http request",
"z": "d41b4dd3.ecd6a",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://localhost:1880/hello-param/Nick",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 390,
"y": 1000,
"wires": [
[
"70c0eba4.5f0dc4"
]
]
},
{
"id": "70c0eba4.5f0dc4",
"type": "debug",
"z": "d41b4dd3.ecd6a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 550,
"y": 1000,
"wires": []
},
{
"id": "83753c80.5e271",
"type": "template",
"z": "d41b4dd3.ecd6a",
"name": "page",
"field": "payload",
"fieldType": "msg",
"format": "html",
"syntax": "mustache",
"template": "<html>\n <head></head>\n <body>\n <h1>Hello {{req.params.name}}!</h1>\n </body>\n</html>",
"output": "str",
"x": 470,
"y": 900,
"wires": [
[
"7fe50f46.46209"
]
]
},
{
"id": "89523bfe.6e5c18",
"type": "inject",
"z": "d41b4dd3.ecd6a",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 240,
"y": 1000,
"wires": [
[
"214bc398.b3482c"
]
]
},
{
"id": "6276a6cd.5c3b18",
"type": "comment",
"z": "d41b4dd3.ecd6a",
"name": "Send HTTP GET request: http://localhost:1880/hello-param/Nick",
"info": "`http request` node can be used to send **HTTP GET** request.",
"x": 350,
"y": 960,
"wires": []
}
]