Top 15 Useful
In this blog, I’m explaining the important modules in
node.js. Node.js have a lot of modules contain but there are some necessary
modules describe here.
Node.js has been very popular these days because of its non-blocking asynchronous
I/O support many developers and companies are converting their existing system
Modules in Node.js
Modules is a simply library file or collection of class or
packages as java which when included in the current application provides extra
features. So a module is simply an “external piece of independent code which
adds additional functionality to the existing structure and application.”
Modules are crucial to building applications in Node, as
they allow you to include external libraries, such as database access libraries
- and they help in organizing your code into separate parts with limited
responsibilities. You should try to identify reusable parts in your own code
and turn them into separate modules to reduce the amount of code per file and
to make it easier to read and maintain your code.
Using modules is simple: you use the require() function,
which takes one argument: the name of a core library or a file system path to
the module you want to load. You’ve seen this before in the simple messaging
application example, where I used require() to use several core modules.
In this blog, just explaining only few modules which are
most important in the node.
Express is a module that contain
all minimum features of web application framework which gives the robust
features to build single and multi-page and hybrid web application easy and
fast. Express when installed globally can be very useful in creating projects
from the command line.
To install the express module by
npm install express
To create an express project in
Jade is a tinplating engine for
node.js (like smarty template system for php.) It is similar in concept to
Jade is default tinplating engine
for express framework. Jade is a high performance template engine heavily
to write more meaningful html.
It can be installed by issuing the
following command from command prompt
npm install jade
MongoDB npm module)
Mongoose is a driver to interact
with MongoDB database management system in node.js. MongoDB database is an
open-source document oriented database, and the leading NoSQL database. MongoDB
features has many features such as indexing, auto sharding, MapReduce, GridFS,
etc. Node.js when combined with MongoDB creates some of the best and fastest modern
applications. The Document in MongoDB have JSON structure with support for
To installed the mongoose by the
npm install mongoose
Mysql is a driver to interact with Mysql
database management system in node.js. To install the mysql module from the
npm install mysql
Nodemailer is a module provide the
facility to send e-mail from your application with Node.js using SMTP.
Nodemailer easy to use.
To install the nodemailer module in
npm install nodemailer
When your application need to
interact with the NoSQL database CouchDB then you may need this module. Nano is
minimalistic CouchDB driver for node.js.
To install Nano module in node.js
npm install nano
Socket.IO module is necessary
module in the node.js. Socket.IO aims to make real-time apps possible in every
browser and mobile device, blurring the differences between the different
To install the Socket.IO module by
the following command:
npm install socket.io
Stylus is an expressive, dynamic,
robust CSS pre-processor for Node.js. It is similar to Sass.js, Sass or Less.js.
Stylus is a revolutionary new language which provides an efficient, dynamic,
and expressive way to generate CSS. It has support for both an indented syntax
and regular CSS style.
To install the Stylus module in
node.js by the following command:
npm install stylus
Calipso is a simple CMS (Content
Management System) like as Wordpress, Drupal, or Zomla. It is designed to be
fast, flexible and simple. It uses MongoDB for database operations. There are
following command to install calispo module:
npm install calipso -g
calipso site /var/www/CMSSite
You can generate pdf using the
PDFKit module in node.js. We can create pdf using PDFKit using plain old HTML
and CSS. In short PDFKit is a PDF document generation library for Node that
helps in creating complex, multi-page, printable documents easy. It’s written
install PDFKit module by the following command:
npm install pdfkit
It is a module to execute many
functions one after the other and we keep on passing callback function to it.
This module is used for the asynchronous programming.
install async module by the following command:
npm install async
Sometimes you may need to do a
repetitive task over and over again like recompiling minification testing etc.
In this case a Task Runner such as Task Runner is really necessary. In others
works its automation tool. It automate the repetitive task such as like
minification, compilation, unit testing, linting, etc, the easier your job
becomes. After you’ve configured it, a task runner can do most of that mundane
work for you-and your team-with basically zero effort.
To install grunt module
by the following command:
npm install grunt
Mocha module is a feature-rich
testing simple and fun. Mocha tests run serially, allowing for flexible and
accurate reporting, while mapping uncaught exceptions to the correct test
To install moncha module by the
npm install moncha
14. Redis Module
It is a module to communicate with
the famous caching server Redis in node.js. This module is a complete Redis
client for node.js. It supports all Redis commands, including many recently
added commands like EVAL.
To install redis module by the
npm install redis
The Forever is the very good
module because it gives the facility to node.js run forever. Every node.js
developer knows that node.js run from the command prompt every time. It is the
fantastic module to run forever. It is closed by simply close the node.js
terminal or shutdown your terminal.
To install forever
module by the following command:
npm install forever
I hope this blog is helpful for you. Thanks!