1. Node js is a combination of v8 crome javascript engine and c++ program.
  2. step to install node js

first download node js software on your computer.

you dont need to install NPM sepratley it also comes with node js setup.

after install node js make sure node js properly installed on your computer using “node -v” command

if version of node js is showing then everything is ok. Now move further

3. if you want to do code using node js it will be difficult for you. so install Express Framework for this.

put this command in cmd to your folder install express = “npm install express”

create app.js file

var express = require('express');
var app = express();

app.get('/', function (req, res) {
res.send('<html><body><h1>Hello World</h1></body></html>');
});

app.post('/submit-data', function (req, res) {
res.send('POST Request');
});

app.put('/update-data', function (req, res) {
res.send('PUT Request');
});

app.delete('/delete-data', function (req, res) {
res.send('DELETE Request');
});

var server = app.listen(5000, function () {
console.log('Node server is running..');
});

important commands node js
1.npm install express
2.npm install mongodb

This will include mongodb folder inside node_modules folder.
mongod -dbpath C:\MyNodeJSConsoleApp\MyMongoDB

3.npm install mssql

Module list to include in node js
var express = require('express');
var http = require('http');
var fs = require('fs');
var MongoClient = require('mongodb').MongoClient;

Mostly used in Express js
app.use(express.static('public'));
app.use('/images', express.static(__dirname + '/Images'));

MongoDB Database working
var MongoClient = require('mongodb').MongoClient;

// Connect to the db
MongoClient.connect("mongodb://localhost:27017/MyDb", function (err, db) {
db.collection('Persons', function (err, collection) {
collection.insert({ id: 1, firstName: 'Steve', lastName: 'Jobs' });
collection.insert({ id: 2, firstName: 'Bill', lastName: 'Gates' });
collection.insert({ id: 3, firstName: 'James', lastName: 'Bond' }); db.collection('Persons').count(function (err, count) {
if (err) throw err;
console.log('Total Rows: ' + count);
});
});
});