What is NodeJS
Node.js is an open-source and cross-platform runtime environment that executes JavaScript code outside of a web browser. We often use NodeJS to build backend services also called APIs(Application Programming Interfaces). APIs power Web Apps and Mobile Apps providing necessary data, sending mails, push notifications, etc.,
NodeJS was introduced by Ryan Dhal.
NodeJS is ideal for building highly scalable, data intensive and real-time backend services that power our client applications. Unlike ASP.NET, django, rails,etc., NodeJS is easy to get started.
Advantages of using NodeJS
- [x] Great for prototyping and agile development
- [x] Used for superfast and highly scalable applications(PayPal, Walmart used NodeJS)
- [x] Able to use JavaScript on server-side
- [x] NodeJS has large ecosystem of open-source libraries(NPM)
NodeJS Architecture
NodeJS is a JavaScript runtime environment. Runtime environment: Every browser has a JavaScript engine that takes JavaScript code as input and converts it into machine readable code. Some examples of JS engines are Chakra(Microsoft Edge), SpiderMonkey(Mozilla Firefox), v8(Chrome). There can be different environments for our code to run(runtime environment).
Ryan Dhal used v8 JavaScript engine and embedded it inside C++ program and created NodeJS. Using NodeJS we can run our JavaScript code outside of web browser. Since NodeJS programs run out of browser, there are some variables that are not available in NodeJS.
Global Variables not available in NodeJS:
- document
- window
Global Variables available in NodeJS:
- global
- process
NodeJS is not a Programming Language, it's a Runtime Environment
When to use NodeJS
NodeJS is recommended for I/O-intensive apps, that require lot of storage or network access. We can serve more client with less hardware because of the asynchronous nature of NodeJS. That's why NodeJS apps are highly scalable.
NodeJS is not recommended for CPU-intensive apps like video encoding or image manipulation services which require many calculations.
Installing NodeJS
You can visit official NodeJS website to download NodeJS. We recommended you to install the LTS version, which will have Long Time Support.
To verify the installed version on your PC, run node -v
or node --version
in your CLI.
Last Updated on
Comments