res.app holds a reference to the Express application that is using the middleware — the same object you create with express().
Officially it is identical to req.app: res.app === req.app is true. Use it to read settings (res.app.get('view engine')), locals, or other app APIs when you are working from the response side.
Syntax
Read res.app in your Express.js route handler. Start with this line.
res.app is an Express.js response property. It runs on a Node.js server (Express 5 needs Node.js 18+). Browsers do not have this API.
✓ Server · Express 4 & 5
res.app
Works wherever Express runs: Node.js is the primary target. Bun and Deno can run many Express apps with compatibility layers. Not available in the browser.
ServerNode.js runtime API
Node.js18+ for Express 5 · 14+ typical for Express 4
Supported
BunExpress-compatible server apps
Supported
DenoVia npm compatibility / adapters
Supported
res.appExpress on Node.js
Bottom line: Study and run these examples with Node.js and the express package. Copy a snippet into a local file and start the server with node.
Frequently Asked Questions
It is a reference on the response object to the Express application instance that is using the middleware — the same object you create with express().
Yes. Officially res.app is identical to req.app. For a given request, res.app === req.app is true.
Call res.app.get('settingName'), the same settings API as app.get / app.set. For example res.app.get('view engine').
Use whichever object you already have in scope. Prefer res.app when the handler is focused on building the response, or when only res is passed into a helper.
No. It is a server-side Express property. Browsers only receive the HTTP response your app sends.