Monday, January 11, 2016

Node Js - Modules

Modules are logical way of breaking down and segregating your codes into an organized codes blocks.
in involes two concept :
Exporting and importing


Exporting : involves a special  object 'exports' created  by Node Module System in every file you create and is returned as value of the 'require'  function when you include that module


Used to expose functions, variables, classes


Importing: Require() function allow you to load and consume modules


Example:













More Efficient Way of above example









No comments:

Post a Comment