Express as Navigation Bar

  node.js, question

Do navigation bars need to be saved in locals because they need to be reused in each page
How to do well

app.route('/')
 .get(function(req,res,next){
 CategoryController.list(function (err, categories){
 if (err) {
 categories = [];
 bracket
 res.locals.cateList=categories;
 var renderData={
 title:"xxx"
 bracket
 res.render('index',renderData);
 });
 })

In doing so, it seems that categories cannot be stored in locals, or is it only available on the home page. what should I do?
Or should app.use and user in app.js be put together?

app.use(function(req, res, next){
 res.locals.user = req.session.user;
 next();
 });

Or do navigation bar or there are other ways to better

Have you used the template engine, such as ejs, and then saved the menu navigation into a partial fragment inside