how to run node js file

Hey Friends!
How are you ? I think you all are fine if not then I pray to God for your good health and happy life.I got a lot of mail from readers about nodejs.

So I have decided to prepare couple of post to clear basic concepts of node.js and I have prepared few posts and I promised you that from these posts you can be able to clear your basic concepts.

Now, at first we set up our system so that it can be able to run node js file.

You are not launching rocket just running a node js file.
Don't worry because you are not launching rocket in which you have to consider a lot of parameters.Your problem is just to run  node js file.
Sharp your axe.
Once Abraham Lincoln had said "Give me six hours to chop down a tree and I will spend the first four sharpening the axe."
So before run node js file at first we have to prepare system so that it can be able to run node js file.
for this purpose  at first consider we have to consider about node js setup.

node js setup

To run node js file at first you have to download Node.js installable archive file from Node js Downloads and install it on your system after that run this command on your system to check that your system is comfortable for running node js file or not.

So, to check your system is comfortable for running node js file or not open your cmd and type

     node --version


If after running this command you got installed version of node js then your system is comfortable for run node js file.Now we create a small node js application for printing hello world on console then we move further.

create nodejs first  application

So for this purpose follow these steps
  • Open your editor like notepad,notepad++ or any text editor.
  • Create helloworld.js file
  • then write following code for printing hello world on console

    console.log('hello world .....');

run code:
for running node js file we have to follow these steps

  • open cmd
  • go to location where file helloworld.js is located using cd command (suppose my is stored on desktop then I will write cd Desktop and now my current directory will be Desktop)
  • After that type command with file name like

   node helloword.js


Output

    hello world .....


In next post we work on more examples and clear more concepts.

Comments

Popular posts from this blog

Secure Database Connectivity in node.js with mysql

Export data from mysql db to csv file using java

API (Application Programming Interface)