What is NodeJs?
- Asynchronous and Event-Driven: The Node.js library’s APIs are all asynchronous, i.e. non-blocking. It basically means that a Node.js-based server never waits for data from an API.
- No Buffering: Data is never buffered in these apps. The data is simply output in chunks by these apps.
- It’s simple to use and used for both prototyping as well as in agile development.
- It offers services that are both quick and scalable.
- Cleaner and more consistent codebase.
Advantages of NodeJs
- Used to build scalable web applications
- Easy to learn
- Growing community
- Helps to create highly performant applications
- Advantage of caching
Disadvantages of NodeJs
- Library support system is not strong
- API is not stable
When to use NodeJs?
NodeJS should be used to create:
- Application based on JSON APIs
- Data streaming applications
- Real time chat applications
Creating the NodeJs server
For creating the NodeJs server, first we need to install it using the given command:
sudo apt install nodejs
Create a file named app.js containing the following contents:
Now run the server using
http://localhost:3000 and you will see a message saying ” Hello Node from Node! “
Thank you for reading, if you really like the blog hit the like button, and to learn more, visit here