Commonly Used Commands

npm init
npm install express
npm install -D nodemon # Development Dependency
 
# Loading another person's project (Download dependencies)
npm install 
 
# Update all the dependencies
npm outdated
npx npm-check-updates -u
npm install
  • Express (Make server using node.js)
  • nodemon (Auto reload local server)
  • request (Access APIs)
  • EJS (Embeded JS Templating)
  • lodash (Provides functions to work with JS)
  • Mongoose (MongoDB ODM)
  • Dotenv (Save Secret data like API and Encryption Keys)
  • Bcrypt (Used to Salt and Hash passwords)
  • validator (Add custom validation to Mongoose)
  • express-validator (Middleware for validator package to add validation to form data)
  • fs (File System - Inbuild Module)

Creating Modules

//Import the module
const moduleName = require('/module');
 
//Use module
const module = moduleName();
 
//Exporting the module
exports = function() {
	//Write code here
};
 
// If multiple functions are present in the module
exports.functionName1 = function() {
	//Write code here
};
 
exports.functionName2 = function() {
	//Write code here
};
 
const moduleName = require('/module');
const module = moduleName.functionName1();