app.locals not passed down to a subapp
- Dominant language
- JavaScript
- Stars
- 69.5k
- Forks
- 25k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
In this example I would expect that `appTitle` will be available to me, because this is what is says in [docs](http://expressjs.com/en/4x/api.html#app.locals).
> The app.locals object has properties that are local variables within the application.
The same way I don't have to set the `'view engine'`, it just uses the one from the parent. But it's not the case, `appTitle` becomes `undefined`.
``` javascript
var express = require('express');
var app = module.exports = express();
app.set('view engine', 'pug');
app.locals.appTitle = 'yay';
var subapp = express();
subapp.get('/', function (req, res) {
res.render('index', {myVar: 'global var'});
});
app.use(subapp);
var port = 5000;
app.listen(port, () => console.log('running on ' + port));
```
Contributor guide
Assessment
This issue has not been assessed yet.