How to clone the Node.js web development tool Express from github and easily run the examples
Sometimes the simplest, easiest things are not documented anywhere, or at least, not documented very clearly, so I just thought I would document what I did here in order to get started running the examples provided in the full Express codebase.
Let's suppose that node and npm are already installed and I am in the home directory of a Linux user. I do:
$ git clone https://github.com/visionmedia/express.git express_examples
and Express is cloned to the express_examples subdirectory. I then change into that directory:
$ cd express_examples
and tell the npm package manager to check for all dependencies (if you are on the Express mailing list see discussion at http://groups.google.com/group/express-js/browse_thread/thread/166a75fdb...):
$ git submodule update --init
$ npm install
The package manager npm will now do a lot of work and pages will scroll by. After a short while the trundling will stop and a ./node_modules directory will be filled with dependencies.
Then you can run any example you like:
$ node examples/blog/app.js
If you now point your browser at the server at port 3000 (i.e. http://example.com:3000) you should see the blog app and be able to try it out as messages are logged to your shell session.
Edit: I did realize after writing this that the following concise instructions are actually to be found in the Readme.md file:
"## Viewing Examples
First install the dev dependencies to install all the example / test suite deps:
$ npm install
then run whichever tests you want:
$ node examples/jade/app.js