How can I change layout depending on roat?

How to change layout depending on the routing, you need to change the default layout with layout admin?
At the entry point settings of the handlebars and get
const express = require('express'),
app = express(),
hbs = require('hbs');

app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');
hbs.registerPartials(path.join(__dirname, 'views/partials'));

app.use('/admin', require('./routes/admin'));

Routing admin
const express = require('express'), 
app = express(),
AdminController = require('../controllers/AdminController'),
AdminRouter = express.Router();

AdminRouter.use(function (req, res, next) {
 if(!req.session.user) {
 return res.redirect('/auth/login');
}

 app.set("view options", {layout: "admin/layout"});
next();
});

AdminRouter.get('/', AdminController.main);
app.set("view options", {layout: "admin/layout"}) in midleware does not work if set in the entry point of initialize, plugs need layout why?
March 23rd 20 at 19:29
1 answer
March 23rd 20 at 19:31
Solution
Sam joked, he laughed.
req, res already app therefore midle res.local.layout = 'str';

Find more questions by tags HandlebarsNode.js