As an aside, there is a project very similar to node.js (however much more cut-down) called Espruino.
This runs on Raspberry Pi (and many low power ARMs microcontrollers too), supports HTTP, and has a function called setWatch which behaves in exactly the way you require.