How to install Nodejs in ubuntu
Posted By Renu Yadav | 31-Jul-2018
Nodejs is open source server environment .By Nodejs you can add , delete and update data in database. In Nodejs you can create API for get the data from the database and store the data in database. Nodejs API return the json format data. So you can show this data in front page of your project. Nodejs is use for handling the backend of project. Nodejs work as asynchronus. Means request come to the thread and go to the event queue .Event queue send the request to the Thread and thread fetch the data from the database.
For installing the Nodejs in your desktop. Follow the below steps to install the Nodejs .
1) Create folder in your drive .
2) Go to the folder in command prompt .
3) Run the command npm init -y .
4) After run the command JSON file is create in your command prompt . After the ENTER the button you get some information about the author name , node version , author , description etc .
5) Run the command npm install express body-parser ejs mongojs --save . This command install the express js , body parser, mongodb.
6) After install the package check the JSON file. You can see that new packages install in your project and that be define in your JSON file.
After install the package in your project . Go the command prompt and go the your project folder. Create js file in your project and paste the below code in js file.
Save the code in your file and run file in command prompt. Go to the your project folder in command prompt and run the command node server . You can see the "now listening for requests" is print on your command prompt. Your Nodejs setup is complete and your file is running on the server.