That's true, but you can that too by defining a http in with /:path
as url ... my complete flow is now:
[
{
"id": "40ea5f2aea6592ae",
"type": "tab",
"label": "API Router",
"disabled": false,
"info": "",
"env": []
},
{
"id": "42175c8109b17081",
"type": "http in",
"z": "40ea5f2aea6592ae",
"name": "",
"url": "/api/:path1",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 104,
"y": 743,
"wires": [
[
"415daddfa2f09e43",
"15c54866d00797d4"
]
]
},
{
"id": "415daddfa2f09e43",
"type": "switch",
"z": "40ea5f2aea6592ae",
"name": "path1 handler",
"property": "req.params.path1",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "accounts",
"vt": "str"
},
{
"t": "eq",
"v": "users",
"vt": "str"
},
{
"t": "eq",
"v": "account",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 4,
"x": 353,
"y": 720,
"wires": [
[
"d6a91b22db931dbd"
],
[
"b03c04d3dbd79e1a"
],
[
"ac85faa6b8f463ac"
],
[
"5f9969817f9c403d"
]
]
},
{
"id": "a6f30d5708e1a412",
"type": "http response",
"z": "40ea5f2aea6592ae",
"name": "",
"statusCode": "",
"headers": {},
"x": 924,
"y": 1194,
"wires": []
},
{
"id": "650565a2d8f644a7",
"type": "link out",
"z": "40ea5f2aea6592ae",
"name": "link out 5",
"mode": "link",
"links": [
"cdfe0a2804636784"
],
"x": 905.5,
"y": 711,
"wires": []
},
{
"id": "fba142a7b0634259",
"type": "link out",
"z": "40ea5f2aea6592ae",
"name": "link out 6",
"mode": "link",
"links": [
"33d7ea129f06d293"
],
"x": 732.5,
"y": 536,
"wires": []
},
{
"id": "168b0844f9b22469",
"type": "http in",
"z": "40ea5f2aea6592ae",
"name": "",
"url": "/api/:path1/:path2",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 113,
"y": 687,
"wires": [
[
"415daddfa2f09e43",
"15c54866d00797d4"
]
]
},
{
"id": "f41d7d3566d08f7e",
"type": "http in",
"z": "40ea5f2aea6592ae",
"name": "",
"url": "/api/:path1/:path2/:path3",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 125,
"y": 633,
"wires": [
[
"415daddfa2f09e43",
"15c54866d00797d4"
]
]
},
{
"id": "d6a91b22db931dbd",
"type": "switch",
"z": "40ea5f2aea6592ae",
"name": "accounts handler",
"property": "req.params.path2",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "all",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 575,
"y": 548,
"wires": [
[
"fba142a7b0634259"
],
[]
]
},
{
"id": "ac85faa6b8f463ac",
"type": "switch",
"z": "40ea5f2aea6592ae",
"name": "account handler",
"property": "req.params.path2",
"propertyType": "msg",
"rules": [
{
"t": "regex",
"v": "^[a-z0-9-]+$",
"vt": "str",
"case": true
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 568,
"y": 720,
"wires": [
[
"dda684b3e27cb284"
],
[
"5f9969817f9c403d"
]
]
},
{
"id": "dda684b3e27cb284",
"type": "function",
"z": "40ea5f2aea6592ae",
"name": "set uuid parameter",
"func": "msg.req.params[\"uuid\"] = msg.req.params.path2;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 766.5,
"y": 712,
"wires": [
[
"650565a2d8f644a7"
]
]
},
{
"id": "5f9969817f9c403d",
"type": "function",
"z": "40ea5f2aea6592ae",
"name": "not found",
"func": "var pa = msg.req.params;\n\nmsg.statusCode = 404;\nmsg.payload = JSON.stringify({\n status: \"not_found\",\n msg: \"page not found\",\n path: msg.req.originalUrl\n})\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 726.5,
"y": 1161,
"wires": [
[
"a6f30d5708e1a412"
]
]
},
{
"id": "7ba18c461581ae70",
"type": "http in",
"z": "40ea5f2aea6592ae",
"name": "",
"url": "/api",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 96,
"y": 796,
"wires": [
[
"5f9969817f9c403d",
"15c54866d00797d4"
]
]
},
{
"id": "b03c04d3dbd79e1a",
"type": "switch",
"z": "40ea5f2aea6592ae",
"name": "users handler",
"property": "req.params.path2",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "all",
"vt": "str"
},
{
"t": "regex",
"v": "^[a-z0-9-]+$",
"vt": "str",
"case": true
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 3,
"x": 570,
"y": 628,
"wires": [
[
"7ade38efb2383248"
],
[
"341c2535113bf35e"
],
[
"5f9969817f9c403d"
]
]
},
{
"id": "7ade38efb2383248",
"type": "link out",
"z": "40ea5f2aea6592ae",
"name": "link out 7",
"mode": "link",
"links": [
"48669bbc4153ba14"
],
"x": 743.5,
"y": 598,
"wires": []
},
{
"id": "341c2535113bf35e",
"type": "function",
"z": "40ea5f2aea6592ae",
"name": "not implemented",
"func": "var pa = msg.req.params;\n\nmsg.statusCode = 501;\nmsg.payload = JSON.stringify({\n status: \"not_implemented\",\n msg: \"TODO functionality\",\n path: msg.req.originalUrl\n})\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 778,
"y": 1085,
"wires": [
[
"a6f30d5708e1a412"
]
]
},
{
"id": "4c5494a48c4005b7",
"type": "http in",
"z": "40ea5f2aea6592ae",
"name": "",
"url": "/:path1",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 96,
"y": 877,
"wires": [
[
"15c54866d00797d4",
"5f9969817f9c403d"
]
]
},
{
"id": "15c54866d00797d4",
"type": "debug",
"z": "40ea5f2aea6592ae",
"name": "debug 23",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 341.5,
"y": 1220,
"wires": []
}
]