run a node application in Command Line
node app.js
how to play around with an application right in the console
node (enter)
then you can define variable and functions/objects etc.
type “control” + “c” twice to get out of this mode
where can you find node.js documentation
nodejs.org
.on method
a method that is responding to an event (used a lot in node.js)
if there is an error thrown, how will i know?
oftentimes there will be an error event shown in the console -
unhandled ‘error’ event
what do you need to do divide up the JSON into an object?
Parse!
JSON.parse(text)
return character in node
\n
return character in node
\n
setInterval()
allows you to do something repeatedly over a set interval. ex:
setInterval(function(){
response.write(new Date() + "\n");
}, 1000);local IP address for all local computers
127.0.0.1