Express req.app Property

Beginner
⏱️ 8 min read
📚 Updated: May 2026
🎯 4 Code Examples

What you’ll learn

  • What req.app references in Express request flow.
  • How to read app settings inside middleware/handlers.
  • How to share app-level helpers safely.
  • How to avoid overcoupling handlers to global app state.

Usage syntax

javascript
req.app
req.app.get(settingName)
1

Read app setting from request

javascript
app.set('siteName', 'CodeToFun');

app.get('/info', function (req, res) {
  res.json({ site: req.app.get('siteName') });
});
2

Use req.app inside middleware

javascript
app.set('requestSource', 'api');

app.use(function (req, res, next) {
  req.source = req.app.get('requestSource');
  next();
});

❓ FAQ

It is a reference to the current Express application object handling the request.
Use it when middleware or handlers need application-level settings or shared app-level values.
Yes. For example, req.app.get('settingName') reads values set with app.set().
Yes, in normal Express request flow it is available on the request object.
Prefer config and shared service references; avoid mutable request-specific state in app object.
Did you know?

req.app gives access to the current Express application instance from inside middleware and route handlers.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

4 people found this page helpful