Book Image

Web Development with MongoDB and Node.js

By : Jason Krol
Book Image

Web Development with MongoDB and Node.js

By: Jason Krol

Overview of this book

Table of Contents (19 chapters)
Web Development with MongoDB and Node.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
12
Popular Node.js Web Frameworks
Index

Installing modules using npm


The module system in Node is so powerful that consuming a third-party module written by other developers is a piece of cake. Node includes its own package manager called npm, which is a registry that currently contains over 60,000 unique modules written in Node. These modules are completely open source and available to you via a few short commands. In addition, you can release your own personal modules via npm and allow anyone in the world to use your feature!

Let's say you wanted to include the popular web framework Express in your project (the one we will be using later in this book). There are simply two steps required to download a module and use it in your code:

$ npm install express
// ** file: usingnpm.js
var express = require('express);

And that's it! Literally, it's that simple! From the command line of the folder where your project is located, simply execute npm install package-name, and the package will be downloaded from npm and stored in a folder called...