Add app.js with code adapted from http://nodejs.org/