Thanks for the speedy response Nick. The GET/POST issue was an oversight on my part.
I wonder if you can help me with the next part of the puzzle. Yesterday I ran my POST server from a node.js command line script, as I could not work out how to make a POST server using node-RED. This should be possible, right? In the example below, the HTTP In node does not fire,and the HTTP Request node outputs an error "Error: connect ECONNREFUSED". What have I missed? (This works fine with the server running from a node.js command line).
[{"id":"f8ddeb2e.7fe338","type":"inject","name":"POST \"foo\" to \"/bar\"","topic":"bar","payload":"foo","repeat":"","crontab":"","once":false,"x":128.57142639160156,"y":351.4285259246826,"z":"4cf1daa3.af57a4","wires":[["dcc86858.e411f8"]]},{"id":"dcc86858.e411f8","type":"function","name":"Build URL and body","func":"// Send an HTTP POST.\n\nvar messageBody = msg.payload;\nvar url = msg.topic;\n\nmsg = {}; \n\nmsg.url = \"
http://localhost:1881/\" + url;\nmsg.payload = \"Payload is \" + messageBody;\n\nreturn msg;","outputs":1,"x":342.8571319580078,"y":349.9999713897705,"z":"4cf1daa3.af57a4","wires":[["ab4af96b.59387","692bcfaa.f629a"]]},{"id":"8b574262.92b8f","type":"debug","name":"HTTP POST Response","active":true,"complete":"true","x":774.2856597900391,"y":318.57140922546387,"z":"4cf1daa3.af57a4","wires":[]},{"id":"ab4af96b.59387","type":"http request","name":"HTTP POST","method":"POST","url":"","x":549.9999961853027,"y":325.71427154541016,"z":"4cf1daa3.af57a4","wires":[["8b574262.92b8f"]]},{"id":"692bcfaa.f629a","type":"debug","name":"POST request","active":true,"complete":"true","x":544.2857131958008,"y":391.428599357605,"z":"4cf1daa3.af57a4","wires":[]},{"id":"8a5c14e2.24fe38","type":"http response","name":"/bar Server Out","x":705.7142639160156,"y":481.42856788635254,"z":"4cf1daa3.af57a4","wires":[]},{"id":"5e4d40d2.f83a98","type":"http in","name":"/bar Server In","url":"localhost:1883/bar","method":"post","x":167.14285278320312,"y":498.57143783569336,"z":"4cf1daa3.af57a4","wires":[["c122f975.6d0828","2cdb04b5.83573c"]]},{"id":"c122f975.6d0828","type":"debug","name":"POST request","active":true,"complete":"true","x":388.5714111328125,"y":540.0000247955322,"z":"4cf1daa3.af57a4","wires":[]},{"id":"2cdb04b5.83573c","type":"function","name":"/bar Server Processing","func":"// grab the POST body and return it\nvar POSTBody = msg.req.body;\n\nmsg = {};\nmsg.res.body = \"POST body received: \" + POSTBody;\n// or do I send this?\nmsg.payload = \"POST body received: \" + POSTBody;\n\nreturn msg;","outputs":1,"x":428.5714111328125,"y":477.14285373687744,"z":"4cf1daa3.af57a4","wires":[["8a5c14e2.24fe38","4a3ae357.db5974"]]},{"id":"4a3ae357.db5974","type":"debug","name":"POST Response","active":true,"complete":"true","x":714.2857284545898,"y":547.1428394317627,"z":"4cf1daa3.af57a4","wires":[]}]