About Me

My photo
I am an innovator, achiever and leaner having more than 10+ year experience in IT industry. I am having experience on various Microsoft technology like .NET, ASP.NET MVC, C#, SQL server. Recently I have moved focus to develop the server less application hence got the experience to working with AWS- Cloud, AWS-Lambda, AWS-S3 bucket, AWS-Web API Gateway and Dynamo DB. I am open source lover, I have used many open source during my tenure like J-query, JQ-grid, node.js, mongo. DB, backbone.js, angular 1.x, and angular 2.0. I am aware about next generation skill like AI, Microsoft cognitive services, development of text based bot and machine learning. I have been working in Accenture since last five year, my current profile is Application Development Lead. Leading an Innovation team, where we have release tons of application for internal as well end client. I am certified application Designer from MIT. and also completed ITIL V3 foundation certification. During my free time, I explore new technologies in area of web , smart solution and artificial intelligent.

Learn Node.js


Node.js


Node.js is an open-source, JavaScript runtime built on Chrome's V8 JavaScript engine for executing JavaScript code server-side. It basically allows to execute your JavaScript code outside the browser.

Now days we are dealing with many JavaScript open source frame work, if we need any of framework to be referenced in our application, we download the reference file from their respecting portal which is time consuming and need details about package, to come out from this problem, Node provides us largest ecosystem of open source libraries in the world. It is central repository for all available open source JavaScript framework.

Let have a quick look how we can use node.js

 Just Go to https://nodejs.org/en/ and install node for window (I am assuming most of you are using window platform), better to install the version which is recommended for most of users.

You will able to see Node command prompt in your start up menu.



Open the node command prompt and run the following command.


Once you run the “Install” command for package, then package will install in “node_modules” folder under the C:\user\{Loginuser}.

If you want to install the multiple package then you will have to create a package.json file , the package.json (I am sure you might be aware about json) file contain the dependency entries of packages which are require to be referenced in project. I have created below package.json. and under the dependencies, I have added entries for angular and JQuery. Make sure you file name should be package.json other bias you will be end up with npm error during the installation.


Now open the Node command prompt, navigate to your project directory where you have package.json and run the below command “npm install” .it will create “node_module” folder under your project folder and all the dependencies packages will install under this folder. 


Let understand how Node.js execute the code outside the browser, lets create a test.js in your project directory and write a small piece of code and run the code using node command prompt. You can see the output the javascript code is getting outside the browser. 



Node.js has a built-in module called HTTP, which allows Node.js to transfer data over the Hyper Text Transfer Protocol (HTTP). The HTTP module can create an HTTP server that listens to server ports and gives a response back to the client. You can develop your web based application which can run on node server. 

import http = require('http');
var port = process.env.port || 1337
http.createServer(function (req, res) {
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.end('Hello World\n');
}).listen(port);


As I am from .Net background, you can use Node.js tool to start with node.js application which is part of VS 2015 update 3. you can see new node.js template under node.js category.



you can get more details about Node.js from its official site https://nodejs.org/en/


I hope you would have got the basic purpose of Node.js, how we can use it in different way. HAPPY LEARNING :) 



No comments:

Post a Comment

Popular Posts