Ryan Dahl is the creator of NodeJS. He thinks why not we can execute javascript outside the browser, So he took Chrome V8 JS engine embedded it into C++ code, named it node.exe, and ran it similar to the browser, now node uses javascript and runs on the server side.
Node is not a programming language. It is a runtime environment for executing JavaScript code outside the browser.
Quite often we can use nodeJS to build backend services like APIs (Application programming interfaces). These services help our client-side applications (Web-applications, mobile applications) to work efficiently. Using a node at the backend we can save, store data, send an email, push notifications, etc.
Node is ideal for building highly scalable, data-intensive, and real-time applications because of its non-blocking behavior (asynchronous) architecture. It is single-threaded. let us look into it.
A request (fetch data) comes to a single thread โ the thread calls the database to fetch data. At the same time, another request comes and the thread starts serving it. When the first request is finished the data fetched from DB then the thread returns it as a response.
Single thread all works using EVENT QUEUE. It monitors the event QUEUE and checks if the data is ready or not.
It is best for I/O and data-intensive tasks. (client-serving)
Not good for CPU-intensive tasks like (Image manipulation, and video encoding)
- Great for prototyping and agile development.
- Super fast and highly scalable.
- Good choice to build highly scalable applications.
- I use javascript everywhere so I need to learn any new language.
- Cleaner and more consistent codebase.
- large eco-system of open-source libraries.
Uber, Paypal, and NetFlix are using nodeJS in production. Paypal Stats shows nodeJS built twice as fast with fewer developers. fewer lines of code and 40% fewer files. Increase 2x req/sec and 35% faster response time.
- How to use EVENTS, HTTPS, OS, and FS modules.
- How to create your custom module, export, and import the module in other files.
- How nodeJS wraps the single file into a module wrapper function and treats it as a module.
- How to download packages from npm.
- Purpose of different flags in npm command.
- How to create your package and publish it on npm.
- How to install and configure the Express framework.
- How to create APIs.
- How to perform crud operations.
- How Asynchronous and synchronous javascript works.
- How callbacks, promises, and async/await works.
- What is NoSql?
- How to use MongoDB in nodeJS.
- How to store, retrieve, update, and delete data from MongoDB.
- How to authenticate a user using JSON web token (JWT).
- How to authorize a user.
- How to handle server-side errors.
- How to log errors in a production application.
- What is unit testing?
- Difference between unit testing, Integration testing, and end-to-end testing.
- How to write test cases?
- How to use any SQL dbms in the node application.