Skip to content

Instantly share code, notes, and snippets.

@dexterlabora
Created June 13, 2017 13:23
Show Gist options
  • Save dexterlabora/339c05eefc1cfad33a1ab90852062cbf to your computer and use it in GitHub Desktop.
Save dexterlabora/339c05eefc1cfad33a1ab90852062cbf to your computer and use it in GitHub Desktop.
Node-RED Basic Flows
[{"id":"cf8e54cb.3685b8","type":"inject","z":"27bac376.4fd3bc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":140,"y":100,"wires":[["32541133.2047ae"]]},{"id":"32541133.2047ae","type":"function","z":"27bac376.4fd3bc","name":"Format Date","func":"var time = new Date(msg.payload);\nmsg.payload = \"Message sent at: \"+time;\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":100,"wires":[["ae8630a2.c0c39","43b585ec.232abc"]]},{"id":"ae8630a2.c0c39","type":"debug","z":"27bac376.4fd3bc","name":"formatted message","active":true,"console":"false","complete":"payload","x":550,"y":100,"wires":[]},{"id":"63c73248.c3599c","type":"http in","z":"27bac376.4fd3bc","name":"","url":"/time","method":"get","swaggerDoc":"","x":140,"y":180,"wires":[["d1712c04.48f36"]]},{"id":"d1712c04.48f36","type":"function","z":"27bac376.4fd3bc","name":"timestamp","func":"msg.payload = new Date().getTime();\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":180,"wires":[["32541133.2047ae"]]},{"id":"43b585ec.232abc","type":"http response","z":"27bac376.4fd3bc","name":"","x":590,"y":180,"wires":[]},{"id":"f27d6851.65c018","type":"inject","z":"27bac376.4fd3bc","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":110,"y":340,"wires":[["28b22403.b0af7c"]]},{"id":"28b22403.b0af7c","type":"http request","z":"27bac376.4fd3bc","name":"","method":"GET","ret":"obj","url":"http://date.jsontest.com","tls":"","x":320,"y":340,"wires":[["e9091cad.bd05f","f6cf7eae.0527a"]]},{"id":"e9091cad.bd05f","type":"debug","z":"27bac376.4fd3bc","name":"json test - timestamp","active":true,"console":"false","complete":"payload","x":300,"y":380,"wires":[]},{"id":"f6cf7eae.0527a","type":"function","z":"27bac376.4fd3bc","name":"Format Message","func":"var time = msg.payload.time\nmsg.payload = \"JSON Test time: \"+time;\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":340,"wires":[["dda98a9c.fc6d28"]]},{"id":"dda98a9c.fc6d28","type":"debug","z":"27bac376.4fd3bc","name":"formatted message","active":true,"console":"false","complete":"payload","x":570,"y":380,"wires":[]},{"id":"eda697ef.e2c9f8","type":"comment","z":"27bac376.4fd3bc","name":"REST API Endpoint","info":"","x":120,"y":60,"wires":[]},{"id":"c41cf463.55e458","type":"comment","z":"27bac376.4fd3bc","name":"REST API Client","info":"","x":100,"y":280,"wires":[]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment