gianlucadelgobbo/mongo-invoices — pull request #2 by gillesruppert (2013-01-03 21:25:13+00:00)
Title: Route refactor

This is a basic refactor of the different routes into separate files.

The refactor also contains some basic fixes (i.e. global variables because of missing `var`, unwanted type coersion of `==` vs `===`, missing radix parameter in `parseInt` calls, etc).

This also includes a simple `.jshintrc`. You can install jshint with `npm install jshint -g` and run it on your files with `jshint path/to/file.js` from the root of the project to catch issues.

Personally: I would clean up the code more: there were mixed spaces and tabs, rows of JS without any spaces between operators, etc, which make the code difficult to read.

As a next step, you could start factoring the anonymous functions into regular functions that are called which would clean up the code some more and possibly show more areas of possible cleanup.

This pull request does **not** fix the stray `x` in the client.jade template as it was not clear at 1st sight to me what should be used instead.

Feel free to reject the pull request & my comments if you prefer having the code how you currently have it. I won't be offended :wink:

I tested it quickly locally and it seems all fine, but I wasn't sure as I can't create a client (I don't have any Italian VAT number or codice fiscale). To test it yourself, you can do the following:
```bash
git clone git@github.com:gillesruppert/mongo-invoices.git
cd mongo-invoices
git checkout route-refactor
npm install
node app.js
```

Let me know if you have any questions.