Example code work with express 4

Made some modifications since the latest release of express 4.x remove connect from his core and some middleware functions became out dated.