Mayank Agarwal has Published 380 Articles

req.cookies Property in Express.js

Mayank Agarwal

Mayank Agarwal

Updated on 29-Jan-2022 07:25:51

1K+ Views

The req.cookies contains the cookies sent by the request while using the cookie-parser middleware. If the cookies are signed, please use the req.signedCookies property.Syntaxreq.cookiesInstall the cookie-parser module −npm install cookie-parserExample 1Create a file with the name "reqCookies.js" and copy the following code snippet. After creating the file, use the command ... Read More

res.append() Method in Express.js

Mayank Agarwal

Mayank Agarwal

Updated on 29-Jan-2022 07:22:30

1K+ Views

The res.append() method can append a specified value to the HTTP response header field. It creates new headers with the specified values, if it's not already created. The value string can take both a string input or an array.Syntaxres.append( field, [value] )Example 1Create a file with the name "resAppend.js" and ... Read More

res.app Property in Express.js

Mayank Agarwal

Mayank Agarwal

Updated on 29-Jan-2022 07:17:58

201 Views

The res.app property holds a reference to the instance of an Express Application that is being used by the middleware.Syntaxres.appExample 1Create a file with the name "resApp.js" and copy the following code snippet. After creating the file, use the command "node resApp.js" to run this code as shown in the ... Read More

req.path Property in Express.js

Mayank Agarwal

Mayank Agarwal

Updated on 29-Jan-2022 07:15:56

1K+ Views

The req.path property contains the path part of the requested URL. This property is widely used to track the incoming requests and their paths. It is mainly used for logging the requests.Syntaxreq.pathExample 1Create a file with the name "reqPath.js" and copy the following code snippet. After creating the file, use ... Read More

app.enabled() Method in Express.js

Mayank Agarwal

Mayank Agarwal

Updated on 29-Jan-2022 07:11:22

155 Views

The app.enabled() method checks whether a setting name property is enabled or not. It basically checks the value of a setting name and returns True if the property value is also True.Syntaxapp.enabled( name )Example 1Create a file with the name "appEnabled.js" and copy the following code snippet. After creating the ... Read More

Node.js - dnsPromises.getServers() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 13:21:31

53 Views

The dnsPromises.getServers() method returns an array of IP address strings, formatted across RFC 5952. These IP strings are currently configured for DNS configurations. The string will include a port only if a custom port is used.SyntaxdnsPromises.getServers( )Example 1Create a file with the name "getServers.js" and copy the following code snippet. ... Read More

Node.js - process.disconnect() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 13:13:53

511 Views

When a Node.js process is spawned with an IPC channel, the process.disconnect() method will close that IPC channel to the parent process, allowing the child process to exit or finish gracefully. The process will exit once there are no other connections keeping it alive.Syntaxprocess.disconnect()Example 1Create two files with the names ... Read More

Node.js - dnsPromises.resolve6() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 13:06:06

80 Views

The dnsPromises.resolve6() method uses the DNS protocol to resolve the IPv6 addresses (AAAA records) for the hostname. The promise is resolved with an array of IPv6 addresses.Syntaxdns.resolve6(hostname, [options])Parametershostname – This parameter takes input for hostname to be resolved.options – It can have the following options −ttl – It defines the ... Read More

Node.js - dns.resolveMx() Method

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 12:57:58

313 Views

The dns.resolveMx() method uses the DNS protocol to resolve mail exchange (MX) records for the hostname. The addresses argument passed to the callback function will contain an array of objects containing both the priority and exchange objects.Syntaxdns.resolveMx(hostname, callback)Parametershostname – This parameter takes input for hostname to be resolved.callback – This ... Read More

Node.js - process.report.directory Property

Mayank Agarwal

Mayank Agarwal

Updated on 17-Jan-2022 12:51:58

98 Views

The process.report.directory property is used to get or set the directory where the report is written. The default value is the empty string that indicates the reports are written to the current working directory of the Node.js Process.Syntaxprocess.report.directoryExample 1Create a file with the name "directory.js" and copy the following code ... Read More

Advertisements