Mayank Agarwal has Published 410 Articles

assert.doesNotThrow() function in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:25:28

182 Views

The assert module provides a bunch of different functionalities that are used for function assertion. The assert.doesNotThrow will assert that the function is unable to throw an error. It will immediately call 'fn' when assert .doesNotThrow is called.Syntaxassert.doesNotThrow(fn, [error], [message])ParametersThe above parameters are described as below −fn – This function will ... Read More

assert.deepStrictEqual() function in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:24:54

177 Views

The assert module provides a bunch of different functionalities that are used for function assertion. One of them is deepStrictEqual() function. This function is used to test the deep equality between the actual and expected parameters. An assertion error will be raised if the condition is not fulfilled.Syntaxassert.deepStrictEqual(actual, expected[, message])ParametersThe ... Read More

Logging in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:24:21

302 Views

Logging is a very essential part in any application whether it is made in Node.js or any other programming languages. Logging helps us to detect weird behaviours of an application along with real-time errors and exceptions. One should definitely put logical logs in their application. These logs help the user ... Read More

Assert Module in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:23:55

208 Views

The assert module provides a bunch of different functionalities that are used for function assertion. This module provides these functions for verifying invariants in a program. We can use assertion for a null check or different other checks. The assertion does not impact any running implementation. It only checks the ... Read More

Integrating Express-rate-limit in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:23:20

289 Views

Rate-limiting is becoming important day by day to prevent websites from DOS & DDOS attacks. The rate-limiting prevents the system from any type of fake requests or other brute force attacks. Rate limiting limits the number of times an IP can make requests. The expressrate-limit is the npm package to ... Read More

Creating custom modules in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:22:48

2K+ Views

The node.js modules are a kind of package that contains certain functions or methods to be used by those who imports them. Some modules are present on the web to be used by developers such as fs, fs-extra, crypto, stream, etc. You can also make a package of your own ... Read More

Creating an Agent in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:22:19

794 Views

You can use new Agent() method to create an instance of an agent in Node. The http.request() method uses the globalAgent from the 'http' module to create a custom http.Agent instance.Syntaxnew Agent({options})ParametersThe above function can accept the following Parameters −options – These options will contain the configurable options that could be set ... Read More

Changing the npm start-script of Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:21:38

9K+ Views

The start-script of a Node.js application consists of all the commands that will be used to perform the specific tasks. When starting or initializing a Node.js project, there are a lot of predefined scripts that will be created for running the application. These scripts can be changed as per the ... Read More

agent.createConnection() Method in Node.js

Mayank Agarwal

Mayank Agarwal

Updated on 20-May-2021 11:20:24

515 Views

The agent.createConnection() method is an interface provided by the 'http' module. This method produces a socket/stream that can be used for the HTTP requests. One can use custom agents to override this method for greater flexibility. A socket/stream can be returned in two ways – either by returning the socket/stream ... Read More

SignUp form using Node and MongoDB

Mayank Agarwal

Mayank Agarwal

Updated on 29-Apr-2021 09:30:47

3K+ Views

In this article, we will create a simple user sign-up form having some parameters. On clicking SAVE, all the user details will be saved in the MongoDB database.InstallationBefore proceeding to create the sign-up form, the following dependencies must be succesfully installed on your system.Check and install express by using the ... Read More

Advertisements