Skip to content

Tag Archives: Express.js

The res.sendFile() function basically transfers the file at the given path and it sets the Content-Type response HTTP header field based on the filename extension. Syntax: … Read More
The res.download() function transfers the file at path as an ‘attachment’. Typically, browsers will prompt the user to download. Syntax: res.download(path [, filename] [, options]… Read More
he res.get() function returns the HTTP response header specified by field. The match is case-insensitive.Syntax:  res.get( field ) Parameter: The field parameter describes the name… Read More
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 which… Read More
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… Read More
The res.status() function set the HTTP status for the response. It is a chainable alias of Node’s response.statusCode. Syntax: res.status( code ) Parameter: This function… Read More
The res.links() function is used to join the links provided as properties of the parameter to populate the response’s Link HTTP header field.Syntax:   res.links( links… Read More
The res.cookie() function is used to set the cookie name to value. The value parameter may be a string or object converted to JSON.Syntax:   res.cookie(name,… Read More
The req.acceptsLanguages() function returns the first accepted language of the specified language on the basis of the request that Accept-Language HTTP header field and it… Read More
The res.type() function is used to set the Content-Type HTTP header to the MIME type determined by the mime.lookup() function for the specified type. Syntax:   res.type(… Read More
The express.json() function is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser. Syntax: express.json( [options]… Read More
The req.acceptsEncodings() function returns the first accepted encoding of the specified encodings on the basis of the request Accept-Encoding HTTP header field and it returns… Read More
The req.acceptsCharsets() function returns the first accepted charset of the specified character sets on the basis of the request’s Accept-Charset HTTP header field otherwise it… Read More
The express.raw() function is a built-in middleware function in Express. It parses incoming request payloads into a Buffer and is based on body-parser. Syntax: express.raw(… Read More
The express.urlencoded() function is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser.Syntax:   express.urlencoded( [options] )… Read More

Start Your Coding Journey Now!