Hi all,
I need to create an application that will accept following:
-
an http GET request to http://your-node-red-instance/time that returns a JSON document containing the current time on the NodeRED server
-
an http GET request to http://your-node-red-instance/random that returns a JSON document containing a generated random number
-
an http GET request to htp://your-node-red-instance/page that returns an http page that shows:
- when the last time was requested
- when the last random number was requested
- the value of the last random number generated
It is important that the time and random number reported by the /page request match exactly the values last returned from /time and /random requests, so I will need to use facilities available in Node-RED to hold these values.
The time must be formatted to have a 2-digit hour in the 24-hour clock.
The response must have a Content-Type of 'application/json' to be properly parsed as a JSON document in {"random" : number}
For example, if the last request to the /time page as at 4 minutes past 1 in the afternoon and the last request to the /random page returned 4 and was made at 23 minutes past 10 in the morning the response should be:
"Time last server time request received at 13:04
Last random number request returned 4, which was received at 10:23"
May I have the code in txt that I can import to Bluemix.