Get Domain Info for Request in Express.js

Mayank Agarwal
Updated on 06-Apr-2022 12:47:07

3K+ Views

We need to get the DNS information to track the address from where we receive the requests. This feature also provides an added layer of security, protecting the application from different type of DOS and DDOS attacks.We can use the following functions to get the domain and host information.SyntaxGetting the origin info:var origin = req.get('origin');Getting the host info:var host = req.get('host');Example 1Create a file with the name "dnsInfo.js" and copy the following code snippet. After creating the file, use the command "node dnsInfo.js" to run this code as shown in the example below −// Getting the Host info Demo Example ... Read More

What is a Photometer: Principle, Working and Types

Manish Kumar Saini
Updated on 06-Apr-2022 08:56:29

4K+ Views

Photometry and PhotometerThe measurement of light's brightness or luminous intensity is known as photometry. Photometry focuses on the perceived brightness to the human eyes. The photometry takes into account the eye's sensitivity to varying degrees of light and focuses primarily on the visible light spectrum.Thus, the photometry involves the measurement of candle power. The candle power of a given source of light in any given direction is measured by comparison with a standard source. In order to eliminate the errors in the measurement of the candle power, the measurement is performed in a dark room with dead black walls."The device ... Read More

What is Spot Welding: Working and Applications

Manish Kumar Saini
Updated on 06-Apr-2022 08:46:01

8K+ Views

Spot WeldingThe welding process which is used for welding two or more metal sheets together by applying pressure and heat from an electric current to the weld area is known as spot welding.Spot welding is a type of resistance welding process, which is why it is also known as the resistance spot welding.Schematic DiagramThe figure below shows the schematic diagram of resistance spot welding −Spot welding is the simplest and most universally adopted method of making lap joints in thin sheet up to a maximum thickness of 12.7 mm.A typical spot welding machine consists of a transformer to produce high ... Read More

What is Seam Welding: Working and Applications

Manish Kumar Saini
Updated on 06-Apr-2022 08:39:37

11K+ Views

Seam WeldingThe welding process in which two similar or dissimilar materials are joined at the seam by the application of heat generated from electrical resistance is known as seam welding. The seam welding is a types of resistance welding, in which weld is produced by roller electrodes instead of tipped electrodes.Most seam welding processes produce a continuous or intermittent seam weld near the edge of two overlapped metals by using two machine driven roller electrodes. As in the seam welding process, the roller electrodes move over the metal workpieces, the workpieces are under pressure and the current passing through them ... Read More

What is Polar Curve in Illumination

Manish Kumar Saini
Updated on 06-Apr-2022 08:32:29

10K+ Views

Polar CurvesThe plots drawn between the candle power and angular position are known as polar curves. Due to unsymmetrical shape of the lamps, the luminous intensity is not uniform in all directions. The luminous intensity in all directions can be represented with the help of polar curves.The polar curves are drawn by taking the luminous intensities in various directions at an equal angular displacement in the sphere. A radial ordinate pointing in any particular direction on a polar curve represents the luminous intensity of the source when it is viewed from the direction.Therefore, the polar curves are classified into two ... Read More

Express.js req.subdomains Property

Mayank Agarwal
Updated on 06-Apr-2022 08:27:37

540 Views

req.subdomains returns an array of all the subdomains in the domain name of the request. The application property subdomain offset is used for determining the beginning of the subdomain segments. The default value of the subdomain offset property is 2.Syntaxreq.subdomainsExampleCreate a file with the name "reqSubdomains.js" and copy the following code snippet. After creating the file, use the command "node reqSubdomains.js" to run this code as shown in the example below −// req.subdomains Property Demo Example // Importing the express var express = require('express'); // Initializing the express and port number var app = express(); // Initializing the ... Read More

Laser Beam Welding Process: Advantages, Disadvantages and Applications

Manish Kumar Saini
Updated on 06-Apr-2022 08:26:34

6K+ Views

Laser Beam Welding (LBW) is a fusion welding process in which multiple pieces of metal are joined together through the use of laser. In LBW, the laser beam acts as a concentrated source of heat, which allows narrow, deep welds and high welding rates. The laser beam welding process is frequently used in high volume applications, such as in the automotive industry.Laser Beam Welding ProcessThe figure shows the schematic diagram of the laser beam welding (LBW).The main parts of the set up used for the laser beam welding are as follows −Laser Machine – It is the machine that is ... Read More

Express JS req.signedCookies Property

Mayank Agarwal
Updated on 06-Apr-2022 08:26:34

318 Views

req.signedCookies contains the signed cookies (ready for use) sent by the request while using the cookie-parser middleware. Signed cookies exist in a different object to show the developer intent, else a malicious attack could be made on the request.cookie values that are relatively easy to spoof.The property defaults are set to "{ }", if no cookies are sent.Syntaxreq.signedCookiesInstalling the cookie-parser modulenpm install cookie-parserExample 1Create a file with the name "reqSignedCookies.js" and copy the following code snippet. After creating the file, use the command "node reqSignedCookies.js" to run this code as shown in the example below −// req.signedCookies() Method Demo Example ... Read More

Express.js req.originalUrl Property

Mayank Agarwal
Updated on 06-Apr-2022 08:23:37

1K+ Views

The req.originalUrl property is similar to the req.url property. This property retains the original URL and lets us rewrite the same to redirect the request further to some other network or as needed. The app.use() method will rewrite the req.url to strip the mount point.Syntaxreq.originalUrlExample 1Create a file with the name "reqOriginalUrl.js" and copy the following code snippet. After creating the file, use the command "node reqOriginalUrl.js" to run this code as shown in the example below −// req.originalUrl Property Demo Example // Importing the express var express = require('express'); // Initializing the express and port number var app ... Read More

Lambert's Cosine Law and Laws of Illumination

Manish Kumar Saini
Updated on 06-Apr-2022 08:23:11

14K+ Views

The light received by any surface depends upon the angle made by the normal to the surface, to the light flux. The Lambert's cosine law of illumination explains the relation between the illumination of the surface and the cosine of the angle.StatementThe Lambert's cosine law of illumination states that"The illumination of a surface is directly proportional to the cosine of the angle between the normal to the surface and the direction of incident light".That is, $$\mathrm{\mathit{E}\propto cos\, \theta \: \: \: \cdot \cdot \cdot \left ( 1 \right )}$$ExplanationCase I – Consider a surface that is normal to the luminous ... Read More

Advertisements