The req.app property holds the reference to the instance of the Express application that is using the middleware.
|
The req.baseUrl property is the URL path on which a router instance was mounted. The req.baseUrl property is similar to the mount path property of the app object, except app.mountpath returns the matched path pattern(s).
|
The req.body property contains key-value pairs of data submitted in the request body. By default, it is undefined and is populated when you use a middleware called body-parsing such as express.urlencoded() or express.json().
|
The req.cookies property is used when the user is using cookie-parser middleware. This property is an object that contains cookies sent by the request
|
The req.fresh property returns true if the response is still ‘fresh’ in the client’s cache else it will return false.
|
The req.hostname property contains the hostname which is derived from the Host HTTP header. It basically returns the hostname which is being supplied in the host HTTP header.
|
The req.ip property contains the remote IP address of the request. It is useful when the user wants the IP address of the incoming request made to the application.
|
The req.ips property contains an array of IP addresses specified in the X-Forwarded-For request header. It returns an array of IP addresses.
|
The req.method property contains a string corresponding to the HTTP method of the request which can be either GET, POST, PUT, DELETE, etc.
|
The req.originalUrl property is much like req.url however, it returns the original request URL thereby allowing you to rewrite req.url freely for internal routing purposes.
|
The req.params property is an object containing properties mapped to the named route “parameters”.
|
The req.path property contains the path of the request URL. This property is widely used to get the path part of the incoming request URL.
|
The req.protocol property contains the request protocol string which is either HTTP or (for TLS requests) https. When the trust proxy setting does not evaluate to false, this property will use the X-Forwarded-Proto header field value if it is present.
|
The req.query property is an object containing the property for each query string parameter in the route.
|
The req.route property contains the currently-matched route which is a string.
|
The req.secure property is a Boolean property that is true if a TLS connection is established else returns false.
|
The req.signedCookies property contains signed cookies sent by the request, unsigned, and ready for use when using cookie-parser middleware.
|
The req.stale property indicates whether the incoming request is stale, and this property is the opposite of req.fresh property.
|
The req.subdomains property contains an array of subdomains in the domain name of the request. The application property subdomain offset, which defaults to 2 determines the beginning of the subdomain segments
|
The req.xhr property returns a true value if the request’s X-Requested-With header field is XMLHttpRequest which indicates that the request was issued by a client library such as jQuery.
|