Intro to Node.js: There’s a Module for That!


08/05/2016

Modules in Node.js

Jamison Prianos, Accusoft Software Development Manager, SaaS

Welcome back to our introductory blog series on Node.js. If you're just joining us today, be sure to check out our previous post on what makes Node.js so popular. Today, we're going to tackle modules.

Are you familiar with the saying, "there's an app for that"? Well, with Node.js, there's a module for basically everything that you might consider doing, aside from whatever your value add is. If you want to develop a certain product, all of the support and tools you need to build it are there, you just build your logic. Below we'll talk a little bit more about the built-in and open source packages available with Node.js.

Built-In Packages


Node.js has built-in packages that don't require external libraries. These built-in packages are made for common tasks involving:

  • Cryptography - Node includes a very robust crypto library. All of the basics are there so you can build a solid encryption in your system and encrypt your own data if you're not sending it over SSL natively.
  • Event-Driven Actions - If you've ever done any event-driven programming, know that it's native in node. There are a lot of built-in libraries that help you write better event-driven applications.
  • HTTP and HTTPS Servers - You can have HTTP(S) servers without introducing external libraries.
  • File Systems - Node.js allows you to work with the file system.
  • Data Streaming - Stream data, whether it's over a network, file system, or some other kind of pipe that's built in.
  • Networking and Sockets - If you need networking and sockets—from the bare bones layers all the way up to HTTP protocols and SSL layers—that's all built directly into Node with no external libraries.

Open Source Packages


For anything that’s not built-in to Node, developers can turn to the open source community. Originally created as a package manager for use with JavaScript and Node, npm now supports a variety of packages—there's now over a quarter million open source packages in the npm repository. You can also take the npm software and run a local repository, so you can have all of your own code sitting at an npm repository. That's ideal, because if you tell npm to pull down a module and it can't find your local repo, it'll go out to the public one and find it. It's pretty transparent; you do a pass through and your libraries come first.

You can also take a lot of the same libraries and run them directly in the browser because, again, it's JavaScript. So if you pulled down a library that does something interesting—a lot of people have used jQuery, Underscore, or any of those on the client side—all those same libraries can be pulled down via npm and used on your server-side code. This offers the same functionality with combining objects and arrays. We can take a lot of the shortcuts we use in the client world and apply that same code on the server side.

When it comes to Node.js, it's all in the modules. For the most part, this platform offers all that you need to build your product, you just have to add your logic. Eager to learn more? Stay tuned for our next post in the series where we'll talk about what makes Node.js different and when you shouldn't use it.


Jamison Prianos is a Software Development Manager in the SaaS division of Accusoft Corporation. In addition to coordinating engineering efforts for his teams, Jamison acts as an evangelist for solid Node development patterns and specifically microservices both within and outside of Accusoft, while also holding on to actual development work for dear life.

Share: Tweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInEmail this to someone

Related posts


TeamCity Dependencies
Visualizing TeamCity Dependencies with Python
Read More >
reactive javascript
Vue.js: Embracing Reactive JavaScript Without Losing Your Mind
Read More >
ImageGear C++ samples
A look at ImageGear C++ Samples
Read More >

Join the discussion.