Category: Node JS Interview Question
-
Why is Node.js preferred over other backend technologies like Java and PHP?
Some of the reasons why Node.js is preferred include:
-
What are the modules in Node.js?
Modules are like JavaScript libraries that can be used in a Node.js application to include a set of functions. To include a module in a Node.js application, use the require() function with the parentheses containing the module’s name. Node.js has many modules to provide the basic functionality needed for a web application. Some of them include: Core…
-
What is the purpose of the module .Exports?
In Node.js, a module encapsulates all related codes into a single unit of code that can be parsed by moving all relevant functions into a single file. You may export a module with the module and export the function, which lets it be imported into another file with a needed keyword.
-
What is NPM?
NPM stands for Node Package Manager, responsible for managing all the packages and modules for Node.js. Node Package Manager provides two main functionalities:
-
Explain the difference between frontend and backend development?
Front-end Back-end Frontend refers to the client-side of an application Backend refers to the server-side of an application It is the part of a web application that users can see and interact with It constitutes everything that happens behind the scenes It typically includes everything that attributes to the visual aspects of a web application…
-
Explain callback in Node.js.
A callback function is called after a given task. It allows other code to be run in the meantime and prevents any blocking. Being an asynchronous platform, Node.js heavily relies on callback. All APIs of Node are written to support callbacks.
-
If Node.js is single-threaded, then how does it handle concurrency?
The Multi-Threaded Request/Response Stateless Model is not followed by the Node JS Platform, and it adheres to the Single-Threaded Event Loop Model. The Node JS Processing paradigm is heavily influenced by the JavaScript Event-based model and the JavaScript callback system. As a result, Node.js can easily manage more concurrent client requests. The event loop is…