Request

router/Request~ Request

Wrapper for the ExpressJS request, exposing only the necessary minimum.

Constructor

new Request()

Source:
Initializes the request.

Members

(nullable) _request :Express.Request

Source:
The current ExpressJS request object, or null if running at the client side.
Type:
  • Express.Request

Methods

getBody() → (nullable) {string}

Source:
Returns body of request.
Returns:
Type
string

getCookieHeader() → {string}

Source:
Returns the Cookie HTTP header value.
Returns:
The value of the Cookie header.
Type
string

getFile() → (nullable) {Object.<string, *>}

Source:
Returns uploaded file to server and meta information.
Returns:
Type
Object.<string, *>

getFiles() → (nullable) {Object.<string, *>}

Source:
Returns upaloaded files to server with their meta information.
Returns:
Type
Object.<string, *>

getHeader(header) → (nullable) {string}

Source:
Returns the specified HTTP request header.
Parameters:
Name Type Description
header string
Returns:
Type
string

getIP() → (nullable) {string}

Source:
Returns the remote IP address of the request.
Returns:
Type
string

getIPs() → {Array.<string>}

Source:
Returns array of IP addresses specified in the “X-Forwarded-For” request header.
Returns:
Type
Array.<string>

getPath() → {string}

Source:
Returns the path part of the URL to which the request was made.
Returns:
The path to which the request was made.
Type
string

init(requestnullable)

Source:
Initializes the request using the provided ExpressJS request object.
Parameters:
Name Type Attributes Description
request Express.Request <nullable>
The ExpressJS request object representing the current request. Use null at the client side.