This property holds a reference to the Express application using Middleware 2 req.baseUrl
The URL link on which a router is mounted 3 req.body
Contains key-value pairs of data submitted in the body section of the Request. By default, it is undefined, and is generated when you use a Middleware to parse the body of the request ( body-parser example) 4 req.cookies
When using cookie-parser middleware, this attribute is an object that contains Cookies sent by Request 5 req.fresh
Determine whether or not Request is "fresh." This attribute is in contrast to req.stale. 6 req.hostname
Contains the hostname section from the "Host" section of the HTTP header. 7 req.ip
Remote IP address of the request. 8 req.path
Contains the path part of the URL in the Request. 9 req.protocol
The protocol string of Request, which is "http" or "https" when requested with TLS 10 req.query
An object contains an attribute for each query string parameter in Router 11 req.route
A string representing the current route is connected to 12 req.secure
Is true if a TLS connection is successfully established 13 req.signedCookies
When using cookie-parser Middleware, this property contains Cookies sent by Request 14 req.stale
Determining whether or not Request is "stale", this attribute is in contrast to the req.fresh attribute. 15 req.subdomains
An array consists of subdomains in the domain name section of the Request
Method req.accepts (types)
req . accepts ( types )
This method checks whether the Content-type is acceptable, based on the Request HTTP Header field of the Request. For example:
// Accept: text/html req . accepts ( 'html' ); // => "html" // Accept: text/*, application/json req . accepts ( 'html' ); // => "html" req . accepts ( 'text/html' ); // => "text/html"
Method req.get (field)
req . get ( field )
This method returns the specific Header field of the Request. For example:
req . get ( 'Content-Type' ); // => "text/plain" req . get ( 'content-type' ); // => "text/plain" req . get ( 'Something' ); // => undefined
Method req.is (type)
req . is ( type )
This method returns true if the Content-Type field of the Request is connected to the Type MIME type specified by the type parameter. For example:
// With Content-Type: text/html; charset=utf-8 req . is ( 'html' ); req . is ( 'text/html' ); req . is ( 'text/*' ); // => true
Req.param method (name [, defaultValue])
req . param ( name [, defaultValue ])
This method returns the value of the name parameter. For example:
// ?name=tobi req . param ( 'name' ) // => "tobi" // POST name=tobi req . param ( 'name' ) // => "tobi" // /user/tobi for /user/:name req . param ( 'name' ) // => "tobi"
According to Tutorialspoint
Previous article: RESTful API in Node.js
Next lesson: Response object in Node.js