Side Project

Even though I am officially unemployed, I have been fortunate enough to have a friend offer me a (sort of) freelance gig. He needs someone trustable to build a backend system for him. I told him I’m more experienced in front-end and gamedev, but he was okay with it. So there we have it, a proper reason for me to learn backend programming.

After some deliberating, I picked up NodeJS, with hopes that the experience will be useful in gamedev (HTML5 multiplayer games, perhaps). I contemplated RoR and GoLang, but decided against those because I had no prior knowledge in Ruby nor Go. Learning a new language -and- figuring out a server framework is going to take longer compared to NodeJS (I’m familiar with Javascript already).

nodejs-icon

But anyway the point of this post is some nuggets of knowledge I picked up so far. NodeJS has NPM (node package manager), which is similar to how RoR has Gems. One of them is Bookshelf.js, a library (built on top of Knex.js) to handle database queries.

Most of the tutorials on Google have sample code that looks something like this:

The last part, catch() , was supposed to catch query errors, but I hit the wall for a couple of hours because Node was telling me that catch()  is not a function. Turns out, it has been changed to otherwise(...) .

Thanks to Que, in his more recent blog posts for using the function, that gave me the revelation. Phew!

Leave a Reply

Your email address will not be published. Required fields are marked *