Difference of using module and own libraries, NodeJS

1

I'm starting at nodejs, it's all "new" and I came across this conflict.

There are modules (I call modules, I do not know if it's right) ready etc ... though I have libraries like CryptoJS that have modules for NodeJS and have your JavaScript library for web. .

Which is more advantageous to use? The module or just threading the file inside the project and use, edit, perfect etc ..

And after all, what's the difference?

    
asked by anonymous 31.10.2015 / 23:29

1 answer

0

Modulo's are libraries for node.js. See the section below api node.js:

  

Node has a simple module loading system. In the node,   files and modules are in a one-to-one correspondence.

Example modules:

  • Circle.js
  • Rectangle.js
  • Square.js

A package is one or more modules (libraries) grouped (or packed) together. These are commonly used by other packages or on a project of their own. Node.js uses a package manager , where you can find and install thousands of packages.

Package example:

Shapes             <- Nome do projeto/package
  - Circle.js      <- 
  - Rectangle.js   <- Modulos que pertencem ao package Shapes
  - Square.js      <-

Essentially, you can install the package, Shapes , and have access to the modules Circle.js , Rectangle.js , Square.js .

    
01.11.2015 / 19:24