Express by Examples

Start and stop express

To start or stop express means to start or stop nodeJS server.

 

START

$node bin/www    -starts nodejs server regularly

$nodemon bin/www     -starts nodejs and restart after every file modification

 

START with debugging

$DEBUG=myproject:server ./bin/www     -starts node with debug option.

 

myproject:server is defined in /bin/www file, and this can be changed.

For example: var debug = require('debug')('myproject:server');  replace into var debug = require('debug')('myapp'); Then run

 $DEBUG=myapp ./bin/www 

 

 

 

STOP

  • CTRL + c    - in Linux
  • $killall -9v node

 

 

RESTART

After starting with $node bin/www restarting is possible with rs + ENTER .

 

 

Now open your browser and type http://localhost:3000

If you want to edit the port do that inside /bin/www file.