Repository navigation
API Request
The Request class extends the Express Request class by adding additional properties.
Type: Applet
This property holds a reference to the CoffeeCat applet to which this request has been routed.
Type: Express.Application
This property holds a reference to the instance of the Express application that is using the applet middleware. This is the same reference returned from applet.app
Type: string
The URL path on which the applet is mounted. Unlike Applet.configuration.applet.path which can contain wild cards, baseURL contains the requested value.
e.g. If Applet.configuration.applet.path contains /gre+t, and a request is made to /greet/hello.html
request.applet.configuration.applet.path will contain /gre+t, while baseURL will contain
/greet.
Type: Object<string,string>
Contains key-value pairs of data submitted in the request body. By default, it is undefined, and is populated when you use body-parsing middleware.
Type: Object<string,string>
When using cookie-parser middleware, this property is an object that contains cookies sent by the request. If the request contains no cookies, it defaults to {}.
Type: boolean
Indicates if whether the request is "fresh".
Type: string
Contains the hostname derived from the Host HTTP header.
Type: string
Contains the remote IP address of the request.
Type: Array
Contains an array of IP addresses specified in the X-Forwarded-For request header, or an empty array.
Type: string
Contains a string corresponding to the HTTP method of the request.
Type: string
Contains the original request URL. This allows you to rewrite req.url for internal routing.
Type: Object<string,string>
Default: {}
This property is an object containing properties mapped to the named route "parameters".
Route parameters are especially helpful in generating "friendly" URLs. If a route is configured as follows:
router.get('/users/:userid', (req, res, next) => {
...
});
Then a request to /users/4532 will be populate the parameters object with { "userid": "4532" }. This format is cleaner for your users than /users?userid=4532
Type: string
Contains the path part of the request URL.
Type: string
Contains the request protocol string.
Type: Object<string,string>
Default: {}
This property is an object containing a property for each query string parameter in the route. If there is no query string, it is the empty object, {}.
Copyright (c) 2017 Michael Anderson