node.js - Using NPM and node Supervisor -


just installed nodejs , npm , nodesupervisor via terminal in os 10.5.8.

i have server running with:

var http = require("http");  function onrequest(request, response) {   console.log("request received.");   response.writehead(200, {"content-type": "text/plain"});   response.write("hello world!");   response.end(); }  http.createserver(onrequest).listen(8888);  console.log("server has started."); 

how restart server, without quitting terminal if following updated:

response.write("hello world, nodejs!"); 

i've seen "^c" used in terminal, in nodejs video tut.

also have node supervisor appears handle these changes, when attempt use watch "-w" command(supervisor -w server.js), on server.js, nothing ("file being watched" or something) returned, , supervisor screen reloads.

npm: 1.0.96 nodejs: v0.4.11

ctrl-c way quit node without quitting terminal together, command-line apps.

a better option might nodemon. restarting node when changes files made.

to install:

npm install nodemon -g

then execute app nodemon instead of node.

nodemon server.js


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -