Node v0.8.0 was released this week. Being a good software developer (nah, lets be honest … maybe just a little bit insane one) I decided to update my sample application I’m using for an upcoming article and conference sessions on building API’s with Node.js and the Express web framework. My current application was using Node v0.6.19 and Express 2.5.10
Upon upgrading I immediately ran into an issue. The res.json(data, status_code) was not working anymore. Instead of returning an array of values I was simply getting the status code back from the app.
The problem was that the order of the params changed.
I posted a question on the Express google group and within a minute TJ already fixed the issue by allowing backwards compatibility of the param order. Very cool. But it is good to note that going forward in Express you will want to use res.json(status_code, data). Kudos to the quick turn around TJ!