Modifying behavior in changing environments
Modifying application data in a running system has been compared to changing the engine of a jet while it is in flight. Luckily, we developers work in a virtual world where the laws of physics are more forgiving. In this section, we will learn how to create a remote control for your Node applications using examples demonstrating how to monitor processes remotely.
Node REPL
Node's Read-Eval-Print-Loop (REPL) represents the Node shell. To enter the shell prompt, enter Node via your terminal without passing a filename:
> node
You now have access to a running Node process and can pass JavaScript commands to this process. For example, after entering 2+2
, the shell would send 4
to stdout
. Node's REPL is an excellent place to try out, debug, test, or otherwise play with JavaScript code.
Because REPL is a native object, programs can also use instances as a context in which to run JavaScript interactively. For example, here, we create our own custom function...