NodeJS Interview and Prep: Top 5 Questions
2 min readJun 19, 2024
- What is NodeJS and where can you use it?
- NodeJS is an open-source cross platform Javascript runtime environment to run web applications outside the client’s browser. It is used to create server side web applications.
- NodeJS is perfect for data-intensive applications as it uses an asynchronous event driven model. You can use I/O intensive web applications.
2. Why use NodeJS?
- It is generally fast, it rarely blocks, offers a unified programming language and data type.
- Everything is asynchronous.
- It yields great concurrency.
3. How does NodeJS work?
- A web server using NodeJS typically has a workflow that is quite similar to the diagram illustrated below.
- First, clients send requests to the webserver to interact with the web application. Requests can be non-blocking or blocking.
- NodeJS retrieves the incoming requests and adds those to the Event Queue.
- The request are then passed one by one through the Event Loop. It checks if the requests are simple enough not to require any external resources.
- The Event Loop processes simple requests (non-blocking operations) such as I/O polling, and returns the…