Introduction to Node.js
Where to use NodeJs?
NodeJS is a platform used to build web apps such as:
- Realtime apps like Chat servers
- Mutiplayer realtime games
- Data streaming servers
- Single page applications
- APIs for mobile
- Apps that require heavy I/O
- Apps that require a high degree of scalability
Node.js infrastructure in a nutshell
NodeJS "chrome v8" is implemented with "LIBUV" Abstraction layer (library created in c++) which enable Node.js to perform seamless input and output operations (operation that happen on the lower level of the OS) across variant of operating systems in a non blocking way. along with LIBUV nodejs comes with a built-in core library that provides a lot of usefull methods that developers can use to write programs such as webservers and network apps,...
All I/O is handled by the Node.js non blocking event loop (provided by LIBUV) which monitors for server events like Database query, File Read/Write, Network I/O.
Node.js is an asynchronous langage but only on events that are handled by LIBUV which means the tasks that are happens on core level in your OS (like reading files, networking, reading databases, etc) but all the code that is handled by v8 is synchronous.
Advantages of using NodeJs
- Provides Event Driven & Non-Bloking I/O which is prfect for apps that requires heavy I/O.
- You write your code from the server up which is perfect for networked & realtime apps.
What will you need to start using Node.Js
To start learning Node.js you will need the following software and knowledges:
- Text Editor (i'm currently using Visual Studio Code)
- Browser or Postman
- Node and NPM (See intallation in the next chapter)