Node JS
💥 Node Js is an open source, Cross-platform run time environment for developing server-side and networking applications. This applications written in Javascript , and can be run within the Node.js run time on OS X, Windows.
- NodeJS Developed by Ryan Dahl. it created with the aim of creating real-time websites with push capabilities. it runs the V8 Javascript Engine, the core of google Chrome, outside of the browser. It is app is run in a single process , without creating a new thread for every request. Node.js provides a set of asynchronous I/O primitives in its standard library that prevent Javascipt code from blocking and generally, libraries in Node.js are written using non-blocking paradigms, making blocking behavior the exception rather than the norm.
Now we are going to see about the features of the NODE.JS 👇
Features of Node.js
- Very Fast:- Being built on Google Chrome V8 JS Engine, Its library is very fast in code execution.
- Asynchronous and Event Driven :- All APIs of Node.js library are asynchronous ,that is non-blocking, It essentially means a Node.js based server never waits for an API to return data. The server moves to the next API after calling it and a notification mechanism of Events of Node.js helps the server to get a response from the previous API call.
- No Buffering :- Its applications never buffer any data.
- License:- Node.js is released under the MIT license.
Who uses Node.js? 🤔
- Some Well-known Resources says that following application are using Node.js
eBay, PayPal,Uber,Yahoo and Yammer etc
Advantages Of Node.js 😀
- Ability to use single programming language from one end of the application to the other hand.
- Support for common tools like Unit Testing.
- Performance increased via caching modules into memory after the first use.
- Easily extensible.
- NodeJs applications are easy to scale both horizontally and vertically.
Disadvantages Of Node.js
- Not suitable for computationally intensive tasks.
- Asynchronous programming model is complex and synchronous model.
- Even though there are Number of libraries available , the actual number of robust libraries is comparatively low.
Hello World in Node.js using WebStrom 🏃
- Check the node version of the machine by using following command
node -v
- Create a new project and named it (In my case it is NodeJS)
- Create a file named HelloWold.js
- Add a console.log command to print the String message.
console.log('Hello World');
- Open the cmd navigate your project path
cd<your project-path>
- Now enter the following command in the cmd and see the output is there.
node HelloWorld.js
Use OS system Library
- Import the OS system Module to your file
const os=require('os');
2. Obtain System Architecture, platform and number of CPU's from the OS module and print them to the console.
console.log('OS :'+os. platform());
console.log('CPU :'+os. cpus().length);
console.log('Architecture :'+os. arch());
3. Run application and check the output.
Node Js is a very powerful javascript based platform built. I touched here a very basic knowledge and stuffs about the Node.js. I hope it might be useful some how for the beginners.
No comments:
Post a Comment