Each team is the soul of a company. And each member of the team brings added value to the project they’re involved in, by bringing in their own, personal approach. Bogdan Ursache, one of our Node.js developers, gave us some tips for better working with the Node.js framework. They include
- building RESTful APIs and why Node.js is suitable for this
- a few examples of famous apps that function on the Node.js framework
- why choose it over other frameworks (such as Ruby on Rails)
- how to better learn it
1. Node.js web framework makes building RESTful APIs easier
From Bogdan’s point of view, the choice of working on a Node.js framework is mainly determined by speed and simplicity (it is a lightweight framework). Normally, Representational State Transfer services don’t require the presence of a framework. But if you want to use frameworks, here are some of the best.
One of the more light-weight frameworks, that don’t force a programmer to use external modules/libraries. Moreover, it functions with a minimum of features. Express, on the other hand, which is the basic Node.js API, contains more functionality (templating and rendering especially): every module needed can be added. Restify is viewed as "a framework that gives absolute control over interactions with HTTP and full observability into the latency and characteristics of my applications."
As opposed to restify, Express can become overwhelming with time (all end points need to be created manually). A complete list of pros and cons can be found here. Nonetheless, Express.js is definitely the most popular, due to its simplicity and the liberty to reach all the advantages of any other framework. Another one of its advantages is the possibility to find many online tutorials (plus support from the community), in case problems occur. This is why it’s best to stick to the more popular frameworks.
Mostly appreciated for its flexibility and the speed with which it allows building an app skeleton, this framework can do wonders for Node.js developers. Other features include blueprints, policies, Waterline (ORM). However, disadvantages are also noticeable, since it is new and hasn’t yet been really tested on properly.
2. Famous apps that function on the Node.js framework
If Bogdan’s favorite frameworks for building APIs haven’t already convinced you of what Node.js can do, here’s a list of apps that definitely will. Speed, scalability and maintainability are among the main advantages these companies looked at when deciding to go for it.
- LinkedIn (back-end for their mobile software stack) switched from Ruby on Rails to Node.js
- Microsoft (Windows Azure)
3. The advantages of using Node.js over Ruby on Rails
One of the main questions Bogdan got when starting to use Node.js was why he felt more attraction towards it than towards - let’s say, the equally popular Ruby on Rails.
Companies such as LinkedIn or Groupon switched to Node.js from Rails because of performance gains and scalability. Software engineers at Groupon claim that the switch was entirely due to the previously monolithic Ruby on Rails applications, that had much trouble scaling.
"Rails still is in use as a RESTful JSON API and for back-end services at Groupon, although plans call for replacing the API with a proxy leveraging Java and Vert.x; the team owning that layer is comfortable with Java" (Sean McCullogh, software engineer at Groupon).
Node.js is only 5 years old (stable version - v0.10.31). Which makes it young and fresh and we know how developers feel when using new programming languages.
General debate assessing the two languages would incline the balance towards Node.js, due to
- its ability to build simple, lightweight web apps
- its speed
- the flexibility in serving as an all-purpose framework (this stands for Express)
- the fizzy and constantly growing community that’s building around it
4. How to better learn it
We wouldn’t be doing our job completely if we didn’t tell you how you can improve your knowledge of Node.js.
Some resources Bogdan recommends include tutorials, blogs and online guides.
- The "Getting started" guide from the Node.js website is a very good point to commence with. The sections on "getting started", "error handling", "using behind proxies" or debugging can set you on the right track.
- the "Express.js Guide: The Comprehensive Book on Express.js", downloadable on Amazon in kindle version
Some useful Node.js blogs include:
A very interesting approach on interactive Node.js lessons, as well as a display of Node.js schools all around the world.
Another blog tackling Node.js tips&tricks, interesting reads or personal points of views on actually working with it.
In the era of social media, podcasts are an option even for Node.js.