Node.js Flashcards

1
Q

What is Node.js?

A

Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: Node.js is single-threaded.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the primary use case for Node.js?

A

Building scalable network applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Fill in the blank: Node.js uses __________ for managing asynchronous calls.

A

event-driven architecture

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is npm?

A

npm is the package manager for Node.js.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True or False: Node.js can be used for front-end development.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What command is used to initialize a new Node.js project?

A

npm init

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of the ‘require’ function in Node.js?

A

To import modules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Multiple Choice: Which of the following is a core module in Node.js? A) express B) fs C) mongoose

A

B) fs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the ‘fs’ module in Node.js stand for?

A

File System

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or False: Node.js is ideal for I/O-heavy applications.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a callback function?

A

A function passed into another function as an argument that is executed after the first function completes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Fill in the blank: Node.js uses a __________ model to handle requests.

A

non-blocking I/O

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the default port for a Node.js application?

A

There is no default port; it can be set to any valid port.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Multiple Choice: Which of the following frameworks is built on top of Node.js? A) Angular B) React C) Express

A

C) Express

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the purpose of middleware in Express.js?

A

Middleware functions are used to process requests and responses in the application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

True or False: Node.js can be used for database management.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the purpose of the ‘next’ function in Express middleware?

A

To pass control to the next middleware function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Fill in the blank: The __________ method is used to send a response back to the client in Express.

A

res.send()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What does the ‘process’ object in Node.js represent?

A

The current Node.js process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Multiple Choice: Which of the following is not a built-in module in Node.js? A) http B) url C) json

A

C) json

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the purpose of the ‘package.json’ file?

A

To manage project dependencies and metadata.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

True or False: Node.js supports promises and async/await for handling asynchronous code.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the event loop in Node.js?

A

The mechanism that allows Node.js to perform non-blocking I/O operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Fill in the blank: The __________ module allows you to create HTTP servers in Node.js.

A

http

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What is the purpose of the ‘cors’ package?

A

To enable Cross-Origin Resource Sharing in web applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Multiple Choice: Which command installs a package globally in Node.js? A) npm install B) npm install -g C) npm install –global

A

B) npm install -g

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is a promise in JavaScript?

A

An object that represents the eventual completion or failure of an asynchronous operation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

True or False: You can run JavaScript code in Node.js without a web browser.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What does the ‘npm start’ command do?

A

It runs the script defined in the ‘start’ property of the package.json file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Fill in the blank: Node.js applications are __________ by default.

A

event-driven

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What is the purpose of the ‘dotenv’ package?

A

To load environment variables from a .env file into process.env.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Multiple Choice: Which HTTP method is used to update a resource? A) GET B) POST C) PUT

A

C) PUT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What does ‘npm audit’ do?

A

It checks for vulnerabilities in your project’s dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

True or False: You can use Node.js for real-time applications like chat apps.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What is the ‘cluster’ module used for in Node.js?

A

To create child processes that can share server ports.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

Fill in the blank: The __________ function handles errors in asynchronous code.

A

catch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What is the ‘body-parser’ middleware used for?

A

To parse incoming request bodies in a middleware before your handlers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

Multiple Choice: Which of the following is a common database used with Node.js? A) MongoDB B) MySQL C) Both A and B

A

C) Both A and B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What is the purpose of the ‘mongoose’ library?

A

To provide a schema-based solution for modeling application data with MongoDB.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

True or False: Node.js supports WebSockets for real-time communication.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

What does the ‘res.json()’ method do in Express?

A

It sends a JSON response.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

Fill in the blank: The __________ method is used to handle GET requests in Express.

A

app.get()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

What is the purpose of the ‘jsonwebtoken’ library?

A

To create and verify JSON Web Tokens (JWTs).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Multiple Choice: Which of the following is NOT a feature of Node.js? A) Event-driven B) Multi-threaded C) Non-blocking I/O

A

B) Multi-threaded

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

What is the significance of the ‘async’ keyword in JavaScript?

A

It allows you to write asynchronous code that looks synchronous.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

True or False: Node.js has built-in support for handling file uploads.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

What is the purpose of the ‘express-session’ middleware?

A

To manage sessions in Express applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

Fill in the blank: The __________ method is used to delete a resource in Express.

A

app.delete()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

What does the ‘crypto’ module in Node.js provide?

A

Cryptographic functionality that includes a set of wrappers for OpenSSL’s hash, HMAC, cipher, decipher, sign, and verify functions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

Multiple Choice: Which of the following is a framework for building RESTful APIs in Node.js? A) Angular B) Express C) Vue

A

B) Express

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

What is the purpose of the ‘nodemon’ package?

A

To automatically restart the Node.js application when file changes are detected.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

True or False: Node.js can be used for server-side rendering of web applications.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

What does the ‘app.listen()’ method do in Express?

A

It binds and listens for connections on the specified host and port.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

Fill in the blank: The __________ module is used to handle HTTP requests and responses in Node.js.

A

http

56
Q

What is the purpose of the ‘multer’ package?

A

To handle multipart/form-data, which is used for uploading files.

57
Q

Multiple Choice: Which of the following is a common testing framework for Node.js? A) Jest B) Mocha C) Both A and B

A

C) Both A and B

58
Q

What is the purpose of the ‘express.Router()’?

A

To create modular, mountable route handlers.

59
Q

True or False: Node.js is only suitable for small applications.

A

False

60
Q

What is the ‘path’ module used for?

A

To work with file and directory paths.

61
Q

Fill in the blank: You can use the __________ module to create a simple HTTP server in Node.js.

A

http

62
Q

What is the role of the ‘npm install’ command?

A

To install a package and its dependencies.

63
Q

Multiple Choice: Which method is used to send a response with a status code in Express? A) res.send() B) res.status() C) Both A and B

A

C) Both A and B

64
Q

What is the purpose of the ‘express-validator’ library?

A

To validate and sanitize user input.

65
Q

True or False: Node.js can handle concurrent connections with a single thread.

A

True

66
Q

What does the ‘res.redirect()’ method do in Express?

A

It redirects the client to a different URL.

67
Q

Fill in the blank: The __________ function is called when an error occurs in a Node.js application.

A

error handler

68
Q

What is the ‘pm2’ package used for?

A

To manage Node.js applications in production.

69
Q

Multiple Choice: Which of the following is a database driver for MongoDB in Node.js? A) mysql B) mongoose C) sqlite3

A

B) mongoose

70
Q

What is the purpose of the ‘helmet’ middleware?

A

To secure Express apps by setting various HTTP headers.

71
Q

True or False: Node.js can be used for building command-line tools.

A

True

72
Q

What does the ‘res.sendFile()’ method do in Express?

A

It sends a file as an octet stream.

73
Q

Fill in the blank: The __________ module is used to create and manage child processes in Node.js.

A

child_process

74
Q

What is the purpose of the ‘compression’ middleware?

A

To compress HTTP responses to reduce their size.

75
Q

Multiple Choice: Which of the following is a method to handle errors in Express? A) app.error() B) app.use() C) app.catch()

A

B) app.use()

76
Q

What does the ‘setTimeout()’ function do?

A

It executes a function after a specified delay.

77
Q

True or False: Node.js can be used to create RESTful APIs.

A

True

78
Q

What is the purpose of the ‘mongoose.connect()’ method?

A

To connect to a MongoDB database.

79
Q

Fill in the blank: The __________ method is used to handle POST requests in Express.

A

app.post()

80
Q

What is the purpose of the ‘express.static()’ middleware?

A

To serve static files such as images, CSS, and JavaScript.

81
Q

Multiple Choice: Which of the following is a popular template engine for Express? A) EJS B) Angular C) React

A

A) EJS

82
Q

What is the function of the ‘os’ module in Node.js?

A

To provide operating system-related utility methods and properties.

83
Q

True or False: Node.js is not suitable for CPU-intensive tasks.

A

True

84
Q

What is Node.js?

A

Node.js is Server-side scripting which is used to build scalable programs. It is a web application framework built on Google Chrome’s JavaScript Engine.

It runs within the Node.js runtime on Mac OS, Windows, and Linux with no changes. This runtime facilitates you to execute a JavaScript code on any machine outside a browser.

85
Q

Is Node.js free to use?

A

Yes. It is released under MIT license and is free to use.

86
Q

Is Node a single threaded application?

A

Yes. Node is a single-threaded application with event looping.

87
Q

What is the purpose of Node.js?

A

These are the following purposes of Node.js:

Real-time web applications
Network applications
Distributed systems
General purpose applications

88
Q

What are the advantages of Node.js?

A

Following are the main advantages of Node.js:

Node.js is asynchronous and event-driven. All API?s of Node.js library are non-blocking, and its server doesn’t wait for an API to return data. It moves to the next API after calling it, and a notification mechanism of Events of Node.js responds to the server from the previous API call.
Node.js is very fast because it builds on Google Chrome?s V8 JavaScript engine. Its library is very fast in code execution.
Node.js is single threaded but highly scalable.
Node.js provides a facility of no buffering. Its application never buffers any data. It outputs the data in chunks.

89
Q

Explain Node.js web application architecture?

A

A web application distinguishes into 4 layers:

Client Layer: The Client layer contains web browsers, mobile browsers or applications which can make an HTTP request to the web server.
Server Layer: The Server layer contains the Web server which can intercept the request made by clients and pass them the response.
Business Layer: The business layer contains application server which is utilized by the web server to do required processing. This layer interacts with the data layer via database or some external programs.
Data Layer: The Data layer contains databases or any source of data.

90
Q

What do you understand by the term I/O?

A

The term I/O stands for input and output. It is used to access anything outside of your application. The I/O describes any program, operation, or device that transfers data to or from a medium or another medium. This medium can be a physical device, network, or files within a system.

I/O is loaded into the machine memory to run the program once the application starts.

91
Q

How many types of API functions are available in Node.js?

A

There are two types of API functions in Node.js:

Asynchronous, Non-blocking functions
Synchronous, Blocking functions

92
Q

What do you understand by the first class function in JavaScript?

A

When functions are treated like any other variable, then those functions are called first-class functions. Apart from JavaScript, many other programming languages, such as Scala, Haskell, etc. follow this pattern. The first class functions can be passed as a param to another function (callback), or a function can return another function (higher-order function). Some examples of higher-order functions that are popularly used are map() and filter().

93
Q

What is the difference between JavaScript and Node.js?

A
94
Q

Explain the working of Node.js?

A

Last

A single thread from the Thread Pool is assigned to a single complex request. This thread is responsible for completing a particular blocking request by accessing external resources, such as computation, database, file system, etc.
Once the task is completed, the response is sent to the Event Loop that sends that response back to the client.

95
Q

How can you manage the packages in your Node.js project?

A

We can manage the packages in our Node.js project by using several package installers and their configuration file accordingly. Most of them use npm or yarn. The npm and yarn both provide almost all libraries of JavaScript with extended features of controlling environment-specific configurations.

We can use package.json and package-lock.json to maintain versions of libs being installed in a project. So, there is no issue in porting that app to a different environment.

96
Q

Why is Node.js Single-threaded?

A

Node.js is a single-threaded application with event looping for async processing.

The biggest advantage of doing async processing on a single thread under typical web loads is that you can achieve more performance and scalability than the typical thread-based implementation.

97
Q

What do you understand by callback hell in Node.js?

A

Callback hell is a phenomenon that creates a lot of problems for a JavaScript developer when he tries to execute multiple asynchronous operations one after the other. A function is called an asynchronous function when some external activity must complete before processing a result.

It is called asynchronous because there is an unpredictable amount of time before a result becomes available. These functions require a callback function to handle errors and process the result.

98
Q

How is Node.js better than other most popular frameworks?

A

Based on the following criteria, we can say that Node.js is better than other most popular frameworks:

js makes development simple because of its non-blocking I/O and even-based model. This simplicity results in short response time and concurrent processing, unlike other frameworks where developers use thread management.
js runs on a chrome V8 engine which is written in C++. It enhances its performance highly with constant improvement.
With Node.js, we will use JavaScript in both the frontend and backend development that will be much faster.
js provides ample libraries so that we don’t need to reinvent the wheel.

99
Q

In which types of applications is Node.js most frequently used?

A

Node.js is most frequently and widely used in the following applications:

Internet of Things
Real-time collaboration tools
Real-time chats
Complex SPAs (Single-Page Applications)
Streaming applications
Microservices architecture etc.

100
Q

What are some commonly used timing features of Node.js?

A
101
Q

What do you understand by the term fork in Node.js?

A

Generally, a fork is used to spawn child processes. In Node.js, it is used to create a new instance of the V8 engine to run multiple workers to execute the code.

102
Q

Which is the best tool we can use to assure consistent code style in Node.js?

A

ESLint tool is one of the best tools we can use with any IDE to ensure a consistent coding style. It also helps in maintaining the codebase.

103
Q

What is the main difference between front-end and back-end development?

A
104
Q

Give an example to demonstrate how can we use async await in Node.js?

A
105
Q

What are the modules in Node.js? Which are the different modules used in Node.js?

A

In Node.js applications, modules are like JavaScript libraries and include a set of functions. To include a module in a Node.js application, we must use the require() function with the parentheses containing the module’s name.

Node.js has several modules which are used to provide the basic functionality needed for a web application. Following is a list of some of them:

106
Q

What are buffers in Node.js?

A

In general, a buffer is a temporary memory mainly used by the stream to hold on to some data until it is consumed. Buffers are used to represent a fixed-size chunk of memory allocated outside of the V8 JavaScript engine. It can’t be resized. It is like an array of integers, which each represents a byte of data. It is implemented by the Node. js Buffer class. Buffers also support legacy encodings like ASCII, utf-8, etc.

107
Q

What is error-first callback?

A

Error-first callbacks are used to pass errors and data. If something goes wrong, the programmer has to check the first argument because it is always an error argument. Additional arguments are used to pass data.

108
Q

What is an asynchronous API?

A

All the API’s of Node.js library are asynchronous means non-blocking. A Node.js based server never waits for an API to return data. The Node.js server moves to the next API after calling it, and a notification mechanism of Events of Node.js responds to the server for the previous API call.

109
Q

How can you avoid callbacks?

A

To avoid callbacks, you can use any one of the following options:

You can use modularization. It breaks callbacks into independent functions.
You can use promises.
You can use yield with Generators and Promises.

110
Q

Does Node.js provide Debugger?

A

Yes, Node.js provides a simple TCP based protocol and built-in debugging client. For debugging your JavaScript file, you can use debug argument followed by the js file name you want to debug.

111
Q

What is a control flow function?

A

Control flow function is a generic piece of code that runs in between several asynchronous function calls.

112
Q

How “Control Flow” controls the functions calls?

A

The control flow does the following job:

Control the order of execution
Collect data
Limit concurrency
Call the next step in a program

113
Q

Is it possible to access DOM in Node?

A

I/O operations
Heavy computation
Anything requiring blocking

113
Q

What is REPL in Node.js?

A

REPL stands for Read Eval Print Loop. It specifies a computer environment like a window console or Unix/Linux shell where you can enter a command, and the computer responds with an output. It is very useful in writing and debugging the codes. REPL environment incorporates Node.js.

114
Q

Explain the tasks of terms used in Node REPL.

A

Following are the terms used in REPL with their defined tasks:

Read: It reads user’s input; parse the input into JavaScript data-structure and stores in memory.

Eval: It takes and evaluates the data structure.

Print: It is used to print the result.

Loop: It loops the above command until user press ctrl-c twice to terminate.

115
Q

Is it possible to evaluate simple expressions using Node REPL?

A

Yes. You can evaluate simple expressions using Node REPL.

116
Q

What is the use of the underscore variable in REPL?

A

In REPL, the underscore variable is used to get the last result.

117
Q

Does Node.js supports cryptography?

A

Yes, Node.js Crypto module supports cryptography. It provides cryptographic functionality that includes a set of wrappers for open SSL’s hash HMAC, cipher, decipher, sign and verify functions. For example:

118
Q

What is npm? What is the main functionality of npm?

A

npm stands for Node Package Manager. Following are the two main functionalities of npm:

Online repositories for node.js packages/modules which are searchable on search.nodejs.org
Command line utility to install packages, do version management and dependency management of Node.js packages.

119
Q

What tools can be used to assure a consistent style in Node.js?

A

Following is a list of tools that can be used in developing code in teams, to enforce a given style guide and to catch common errors using static analysis.

JSLint
JSHint
ESLint
JSCS

120
Q

What is the difference between operational and programmer errors?

A

Operational errors are not bugs, but create problems with the system like request timeout or hardware failure. On the other hand, programmer errors are actual bugs.

121
Q

What is the difference between the global installation of dependencies and local installation of dependencies?

A

Global installation of dependencies is stored in/npm directory. While local installation of dependencies stores in the local mode. Here local mode refers to the package installation in node_modules directory lying in the folder where Node application is present.

Globally deployed packages cannot be imported using require() in Node application directly. On the other hand, locally deployed packages are accessible via require().

To install a Node project globally -g flag is used.
C:\Nodejs_WorkSpace>npm install express ?g
To install a Node project locally, the syntax is:
C:\Nodejs_WorkSpace>npm install express

122
Q

What is the use of a buffer class in Node.js?

A

The Node.js provides Buffer class to store raw data similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. It is a global class and can be accessed in an application without importing a buffer module. Buffer class is used because pure JavaScript is not compatible with binary data. So, when dealing with TCP streams or the file system, it’s necessary to handle octet streams.

123
Q

What is the role of assert in Node.js?

A

The Node.js Assert is a way to write tests. It provides no feedback when running your test unless one fails. The assert module provides a simple set of assertion tests that can be used to test invariants. The module is intended for internal use by Node.js, but can be used in application code via require (‘assert’). For example:

124
Q

What are the streams in Node.js?

A

The Streams are the objects that facilitate you to read data from a source and write data to a destination. There are four types of streams in Node.js:

Readable: This stream is used for reading operations.
Writable: This stream is used for write operations.
Duplex: This stream can be used for both reading and write operations.
Transform: It is a type of duplex stream where the output computes according to input.

125
Q

What is event-driven programming in Node.js?

A

In Node.js, event-driven programming means as soon as Node starts its server, it initiates its variables, declares functions and then waits for an event to occur. It is one of the reasons why Node.js is pretty fast compared to other similar technologies.

126
Q

What is the difference between events and callbacks in Node.js?

A

Although, Events and Callbacks look similar the differences lies in the fact that callback functions are called when an asynchronous function returns its result whereas event handling works on the observer pattern.

Whenever an event gets fired, its listener function starts executing. Node.js has multiple in-built events available through the events module and EventEmitter class which is used to bind events and event listeners.

127
Q

What is the Punycode in Node.js?

A

The Punycode is an encoding syntax which is used to convert Unicode (UTF-8) string of characters to ASCII string of characters. It is bundled with Node.js v0.6.2 and later versions. If you want to use it with other Node.js versions, then use npm to install Punycode module first. You have to used require (‘Punycode’) to access it.

128
Q

What does Node.js TTY module contains?

A

The Node.js TTY module contains tty.ReadStream and tty.WriteStream classes. In most cases, there is no need to use this module directly. You have to used require (‘tty’) to access this module.

129
Q

What are the main differences between operational and programmer errors?

A

The most crucial difference between operational and programmer errors is that the operational errors are not bugs but problems with the system such as to request timeout or hardware failure. On the other hand, the programmer errors are actual bugs in the application.

130
Q

What do you understand by an EventEmitter in Node.js?

A
131
Q

What is the difference between readFile and createReadStream in Node.js?

A

In Node.js, there are two ways to read and execute files: readFile and CreateStream.

The readFile() process is a fully buffered process that returns the response only when the complete file is pushed into the buffer and is read. This process is called a memory-intensive process, and in the case of large files, the processing can be very slow.
On the other hand, the createReadStream() is a partially buffered process that treats the entire process as an event series. The entire file is split into chunks and then processed and sent back as a response one by one. After completing this step, they are finally removed from the buffer. Unlike the readFile process, the createReadStream process is effective for the processing of large files.

132
Q

What is the concept of Punycode in Node.js?

A

In Node.js, the concept of Punycode is used for converting one type of string into another type. Punycode is an encoding syntax used for converting Unicode (UTF-8) string of characters into a basic ASCII string of characters. Now, the hostnames can only understand the ASCII characters so, after the Node.js version 0.6.2 onwards, it was bundled up with the default Node package.

To use it with any previous versions, you have to use the following code:

punycode = require(‘punycode’);

133
Q

How can you enhance the Node.js performance through clustering?

A

Just because the Node.js applications run on a single processor, they don’t take advantage of a multiple-core system by default. Clustering is used to overcome this issue. The cluster mode is used to start up multiple node.js processes, thereby having multiple instances of the event loop. When we start using clusters in a Node.js app, it creates multiple node.js processes. But there is also a parent process called the cluster manager, which is responsible for monitoring the health of the individual instances of the application.

134
Q

What is a thread pool in Node.js? Which library handles it?

A