- 2015-08-21: 50% less server load with MongoDB on the Drupal 7 site factory at France Télévisions
- 2015-07-15: Our first Drupal 8 production site at France Télévisions is live
- 2014-08-18: 400% speedup in 3 weeks for http://france3-regions.francetvinfo.fr/ : who said Drupal back-offices had to be slow ?
- 2014-02-07: Sotchi Olympics traffic not a problem for http://www.francetvsport.fr/ , which I rearchitected on Drupal 7 in 2013
- 2011-09-14: Completed migration of FranceInfo.FR from SPIP to Drupal
- 2011-07-13: The new social network features of Le Figaro are now powered by an OSInet-designed MongoDB implementation
- 2010-12-21: Madame Figaro brand new site by OSInet and others
- 2010-08-16: France.FR is back online with OSInet and Typhon
- 2010-06-15: the new France Culture, which OSInet helped reach its performance goals, is now online
Missing the Connect Router middleware for Node.js ?
I recently decided to actually run the examples in David Herron's Node Web Development book (disclaimer: Amazon affiliate link) and, while all examples until the middle of chapter 4 worked with the current Node 0.6.14 version, the Connect examples rely on the Router middleware, which TJ Holowaychuck removed from Connect.
Of course, Connect 1.6.1 still contains the Router, but it only works from Node 0.4.1 included to 0.5.0 excluded. And I still wanted to see these examples run on a current Node. A simple (and dirty) hack did the trick:
- clone Connect from Github:
git clone https://github.com/senchalabs/connect.git
- note the last commit before the Router was removed, to obtain the most up-to-date version: 7d96c75960c9a6502d44bc367c97ab8101d660e6, or 7d96c7 for short
- checkout that version:
git checkout 7d96c7
- in your project, install Connect normally. These days, this gives you version 2.1.0
lib/middleware/router.jsfrom your Connect detached checkout to the
node_modules/connect/lib/middleware/directory under your project directory.
- at this point, you will notice that the
router.generateMethodFunction()code makes use of the defunct
flatten()method. If you do not plan on chaining middleware, or more generally use the
middlewareproperty on your router callback, you can just comment out that line: this is sufficient to run the examples in David's book, although it breaks the middleware chaining mechanism for more advanced uses.
- restart Node: at this point, the book examples work.
Now, is this really a solution to use the Connect router ? Definitely not ! But it lets you run the Connect examples in the book, to get a better feel about them. If you really want to use that router, you should maintain it as a separate component; but in most cases, you will want to take the next step and move on to Express, or your own custom router component.
About the "Node Web Development" book itself
As commenters on Amazon.com have mentioned, Node itself is moving a breakneck pace, so any book published in 2011 is no longer completely usable in 2012 but, after browsing a number of blogs and being quite annoyed by the only other book available about Node, I consider this one to be the most useful, and i also contributed a number of errata with fixes on Packtpub.com, which the publisher may even publish to keep the book more current.
Like most Packt books, this one is rather thin and quickly read, but will help get the job done far more easily than spending days on blogs or trying to make sense of Node + npm modules available, without any idea where to start, or even relying on the very incomplete only other non-Packt book about Node. More books definitely need to be written while Node and its major middleware matures, but until then, this one is my choice.