Getting started with Node.js and express

# working in ubuntu 12.04

# add package to get latest version to not get errors
sudo add-apt-repository –yes ppa:chris-lea/node.js
sudo apt-get update

# install node.js and npm
sudo apt-get install nodejs npm

# install express framework
$ sudo npm install -g express
$ sudo npm install -g express-generator

# create project
$ express testexpress
$ cd testexpress
$ sudo npm install

# or if you wish to create project with hogan (handlebars) and less
$ express testexpress –hogan -c less

# to run the app
$ DEBUG=testexpress ./bin/www

# miscellaneous
$ npm install -g nodemon

// add code to bottom of app.js to run as 
// $ node app.js
module.exports = app;
/* Use PORT environment variable if it exists */ 
var port = process.env.PORT ||3000;
server = app.listen(port);
console.log('Server listening on port %d in %s mode', server.address().port, app.settings.env);