devnotes.

Request Complete Reference

A quick reference for the req object's most commonly used properties and methods.

Properties

PropertyDescription
req.appReference to the current Express app instance.
req.baseUrlThe path on which a router is mounted.
req.bodyParsed request body (needs a body-parsing middleware).
req.cookiesCookies sent by the client (needs cookie-parser).
req.freshWhether the client's cache is still fresh.
req.hostnameHostname derived from the Host header.
req.ipThe client's IP address.
req.ipsIPs from X-Forwarded-For when trust proxy is enabled.
req.methodThe HTTP method used.
req.originalUrlThe original request URL before internal rewrites.
req.paramsNamed route parameters.
req.pathThe path portion of the URL.
req.protocolhttp or https.
req.queryQuery-string parameters.
req.routeThe matched route.
req.securetrue if the connection uses TLS.
req.signedCookiesSigned cookies (needs cookie-parser with a secret).
req.staleThe inverse of req.fresh.
req.subdomainsSubdomains present in the hostname.
req.xhrtrue for XMLHttpRequest-based requests.

Methods

MethodDescription
req.accepts()Checks acceptable content types.
req.acceptsCharsets()Checks acceptable character sets.
req.acceptsEncodings()Checks acceptable content encodings.
req.acceptsLanguages()Checks acceptable languages.
req.get()Reads a request header.
req.is()Checks the request's content type against a MIME type.

Keep this table handy when you need to quickly recall what a particular req property or method does.

Request Complete Reference | DevNotes