What is Node.js
Events can be:
1) A new HTTP request coming our way
2) Timer wait is complete
3) Next chunk of data is ready to be written to the file
Why node is single threaded?
Node.Js was built with the intention of supporting asynchronous operations and the fact is that the asynchronous operations have better performance and scalability when they are single-threaded over multi-threaded. This is the reason the Node.Js is single threaded.
Features of Node.js
1) Server Side java Script
3) High Reliability
5) Single Threaded
6) Run Anywhere
7) No Buffering
8) Easy Integration with JS Stacks
9) Speedy Execution
Top websites powered by Node.js
For more info visit: https://codebrahma.com/top-10-sites-powered-by-node-js/
For Linux follow the guide.
For Windows download the installer.
To check if nodejs is installed successfully, Open command prompt and type
What is NPM
Set up node.js application
Before create a node.js application we need to install express framework using npm command. ( Express is a lightweight and easy to use Node.js framework that helps to create and manage our apllication into MVC architecture.Express provides a robust set of features to develop mobile and web applications)
To install express run
npm install express -g
The above command will install express globally on your machine. then type
npm install express-generator -g
It will install the express generator globally on your machine. After that to create the skeleton of node app just type
This will create the node.js skelton with name projectName, where project name is the name of your app skeleton. After that just go in the app structure and install the app dependencies by
cd projectName npm install
It will create the node modules folder where it install all the dependencies, after that just type npm start command to start the server and check it works or not. To check its proper working after run the start command just open any browser and type localhost:3000 to check the server is listening or not (3000 is the default port uses by it).
Now open any browser and hit localhost:3000