I am very new to node js, you can say at beginner level. But i wish to share, my learning in node js. Today i run node js Hello world! App. So, i am going to demonstrate the Hello World! example in node js with full steps to set up.
In next node js blog, i will share node js with database connection with an working example.
Please write in comments, if i wrote anything wrong here. I will appreciate if i will learn from you guys.
So, lets start setting up Node JS environment . First, you need to install node js package on your system. If you are not sure about this then you can check whether you have installed or not node js and npm. You can check by using this command –
node - v
this will give you nodejs version you are using
this will give npm version you are using.
If you starting from scrtach then you should visit this article – How to install node js pacakage on windows
Now, after these steps, You have node js and npm installed on your machine to start with node js.
Now, we will install Express. Express is a node js web application framework. It organize your web app into a MVC architecture on the server side. ‘
Write below command in folder where you want to set up your node js web application –
npm install -g express
This will install some core functionality into our node installation and we can use it anywhere globally into our code. We need to install express generator as well. Installing the express generator is very easy, just write down below command in your console –
npm install -g express-generator
Now, we will create our express project by using below command –
(Please note – nodetest is app name)
Now, we will instal the npm dependencoes in the nodetest folder –
Now, our full functional wep app is ready to run. But, lets do some preparation for database. Lets create a folder to store our mongo or mysql db data. We will not use this folder for now.
Lets start our web server –
Ya, it’s working. Open the link http://localhost:3000/ in the browser. You will see Welcome to Express Page.
We are running now, Node js web server with express engine and jade html preprocessor installed. Next, we will play with the code and will write a small app. Thanks for reading and commenting. .:)