node.js

NODE JS

    • Is a command-line tool that can be run as a regular web server and lets one run JavaScript programs

    • It utilizes the great V8 JavaScript engine. V8 is the JavaScript execution engine built for google chrome. V8 compiles JavaScript source code to native machine code instead of interpreting it in real time.

    • is very good when you need to do several things at the same time

    • is event-based so all the wonderful Ajax-like stuff can be done on the server side

    • lets us share code between the browser and the backend

    • Node.js is especially suited for applications where you'd like to maintain a persistent connection from the browser back to the serve

    • Using a technique known as 'long-polling', you can write an application that sends updates to the user in real time

    • It runs Javascript, so you can use the same language on server and client, and even share some code between them (e.g. for form validation, or to render views at either end.)

    • It has become the defacto standard environment in which to run Javascript-related tools and other web-related tools, including task runners, minifiers, beautifiers, linters, preprocessors, bundlers and analytics processor.

      • NPM - NODE PACKAGE MANAGER

      • npm init - will create package.json file. We can manually create or edit the package.json file. It will keep track of package dependencies and details of the p

      • When installing package say npm install express --save will save the metadata inside package.json which will be very helpful in distributing the application.

      • CORS - cross origin resource sharing ( you can add this module if you want to open your api, so it is accessible from any domain)

      • Parse the form variables - we can use body-parse.

      • underscore - Underscore provides over 100 functions that support both your favorite workaday functional helpers: map, filter, invoke — as well as more specialized goodies: function binding, javascript templating, creating quick indexes, deep equality testing, and so on.