Home / Function/ res() — express Function Reference

res() — express Function Reference

Architecture documentation for the res() function in response.js from the express codebase.

Entity Profile

Dependency Diagram

graph TD
  654363af_a1b9_0807_17be_896895e23cd5["res()"]
  e8de3182_7771_c885_d297_ca4255bae3a6["response.js"]
  654363af_a1b9_0807_17be_896895e23cd5 -->|defined in| e8de3182_7771_c885_d297_ca4255bae3a6
  3a8eeb41_c3ab_1043_2f9b_9c59cbe60e16["stringify()"]
  654363af_a1b9_0807_17be_896895e23cd5 -->|calls| 3a8eeb41_c3ab_1043_2f9b_9c59cbe60e16
  7cf11697_b32b_3362_0b5d_beb3602edbdc["sendfile()"]
  654363af_a1b9_0807_17be_896895e23cd5 -->|calls| 7cf11697_b32b_3362_0b5d_beb3602edbdc
  style 654363af_a1b9_0807_17be_896895e23cd5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/response.js lines 64–76

res.status = function status(code) {
  // Check if the status code is not an integer
  if (!Number.isInteger(code)) {
    throw new TypeError(`Invalid status code: ${JSON.stringify(code)}. Status code must be an integer.`);
  }
  // Check if the status code is outside of Node's valid range
  if (code < 100 || code > 999) {
    throw new RangeError(`Invalid status code: ${JSON.stringify(code)}. Status code must be greater than 99 and less than 1000.`);
  }

  this.statusCode = code;
  return this;
};

Domain

Subdomains

Defined In

Frequently Asked Questions

What does res() do?
res() is a function in the express codebase, defined in lib/response.js.
Where is res() defined?
res() is defined in lib/response.js at line 64.
What does res() call?
res() calls 2 function(s): sendfile, stringify.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free