In this blog series, we will go over the most important categories of tools that are closely related to all aspects of successful nodestering—from development environments, frameworks, and test and build tools to continuous integration, delivery, and monitoring. So, without further ado, let’s start our journey through the world of Node.js tools.
Disclaimer: You will probably notice that the tools showcased are a bit pro-backend or DevOps-oriented. I apologize for that, but keep in mind that many of the tools and their applications go beyond just backend/frontend/desktop/mobile: Their purpose is to build good quality software in general.
What is a developer without a good integrated development environment (IDE)? The answer is simple: Unproductive. A good IDE will not let you leave its windows, menus, shortcuts, etc. ever (except to take a look at the browser). Code completion, support for various tools, plugins, debuggers, good performance, and good themes are simply the prerequisites for a good IDE, whether it’s free or a paid product.
Since Node.js development on Windows is no longer that uncommon, .NET developers-turned-nodesters will appreciate Visual Studio or any of the many general (cross-platform) editors like Sublime Text, Atom, Brackets, Visual Studio Code, or even NetBeans. They all have the basics right and are good tools. Give them a try.
Some of the most interesting features for Node.js developers might be the ability to easily do memory heap analyses and CPU profiling with visual representation via flame charts. Read more about it here.
2) Build Tools
Gulp touts itself as an easy-to-learn and easy-to-use streaming build system and is very popular for its flexibility. It aligns really well with Node.js streams and their ability to pipe.
In general, there is a lot of overlap in terms of satisfying developer needs for both of these, but for a more generalized understanding, we can say that Gulp is more focused on writing code and Grunt on writing configurations. It’s up to you to evaluate your needs and try to find a good fit for your projects.
Another approach to builds and automation in the Node.js world is using npm-scripts. This is due to its simplicity (remember the KISS principle?) and tight integration with Node’s faithful counterpart, the famous node package manager (npm). Simply add them to your package.json file and run via npm run <script_name>. In addition it provides hooks and you can run local modules you might have so you don’t need to install them globally.
4) REST API Frameworks and Services
If you are using Node.js to build REST API services (microservices, anyone?) and haven’t opted out for a more esoteric framework, then you are left with a few well-known and battle-tested frameworks. Those are Restify, HAPI and Express.js.
Express.js is probably the most widespread and well-known framework that is used for all sorts of web (app) development including API development. Not so long ago, it was considered too bloated for API development, but in its last incarnation (version 4) this is no longer the case. It has been seriously re-architected to be light, and all the niceties you may remember from previous versions that were available almost out of the box are now available as separate modules that you plug in and use depending on your needs (as anything else in Node’s module ecosystem).
Restify is a popular choice for rest APIs as it is a very straightforward framework with API development in mind only. It has some features that set it apart from others like out-of-the-box support for DTrace and built-in REST Clients for easy and fast consumption of other services (very useful if you are building an API gateway microservices component).
HAPI is another great framework that focuses on simplicity and performance, but it is not so widespread as the previous ones and thus may be lacking in ecosystem richness and widespread production maturity. Definitvely worth a consideration when building an API with performance in mind.
StrongLoop Loopback is another open-source framework that could help you out in this area. It’s a more comprehensive toolset that generates a lot of the code for you (models, database migrations) and can get you very far in a short time. But as with any bigger framework, you delegate your sense of security in code and knowledge of it and thus risk a possible lock-in that may be costly in the end. Surely this is a good contender, as it is backed by IT giants like IBM, and the tooling being developed for it and around it is and will be more and more impressive and maybe even enterprise-production grade.
To test your REST API services, you will need a good REST client. If you like curl, fine, knock yourself out, but for those of us who like something more intuitive, visual, and full of savings/categorizing/sharing features, Postman is a perfect tool.
5) Test Frameworks and Tools
For a more comprehensive example of how to install, configure, and use Jasmine and Karma, take a look at this AngularJS testing article.
It’s good to know that the JUnit “standard” of describing test results (XML file) is very accepted, tool-rich, and widespread so these test tools gravitate to or have a strong support (via plugins or modules) to give you that desirable JUnit output with little effort.
Was This List Useful?
Stay tuned for more recommendations for Node.js developers in Part 2.