The req.app property provides access to the current Express application instance from within a route handler or middleware. It allows you to access application-level settings, methods, and variables defined using the Express app object.

Syntax:
req.appParameter: No parameters.Â
Return Value: Returns the current Express application instance.
Installation of the express module:
You can visit the link to Install the express module. You can install this package by using this command.
npm install expressAfter installing the express module, you can check your express version in the command prompt using the command.
npm version expressAfter that, you can just create a folder and add a file, for example, index.js. To run this file you need to run the following command.
node index.jsProject Structure:

Example 1: Filename: index.jsÂ
const express = require("express");
const app = express();
const PORT = 3000;
app.set("appName", "GeeksforGeeks");
app.get("/", (req, res) => {
console.log(req.app.get("appName"));
res.send("Application Name Retrieved");
});
app.listen(PORT, () => {
console.log(`Server listening on PORT ${PORT}`);
});
Steps to run the program:
Make sure you have installed the express module using the following command:
npm install expressRun the index.js file using the below command:
node index.jsOutput:
Console Output:

Browser Output:Â
Now open your browser and go to http://localhost:3000/, now you can see the following output on your console:

Example 2: Filename: index.jsÂ
const express = require("express");
const app = express();
const PORT = 3000;
app.set("company", "GeeksforGeeks");
app.get("/user", (req, res) => {
res.send(req.app.get("company"));
});
app.listen(PORT, () => {
console.log(`Server listening on PORT ${PORT}`);
});
Steps to run the program:
Run the index.js file using the below command:
node index.jsConsole Output:

Browser Output: Now open your browser and make a GET request to http://localhost:3000/user, now you can see the following output on your console:

Working of req.app
- The client sends an HTTP request.
- Express executes the matching route or middleware.
- The req.app property provides access to the current Express application instance.
- You can access application-level settings or methods using req.app.
- The server sends the response back to the client.
Use Cases of req.app
- Accessing application settings
- Sharing global configuration
- Using application-level variables
- Accessing Express methods from middleware
- Building modular Express applications