Show user all frontend views with res.locals

Hello guys,

I am trying to develop in nodejs and express an admin panel.

I am using passport with the LocalStrategy for authentication.

I would like to show in all the frontends in the navigation bar. Hence, passing the user all the time by the routes to the frontend is not an option. For this I have written the following custom middleware:

app.use((req, res, next) => {
  res.locals.user = req.user

However, both console.log request give me undefined back.

Please find here my github repo for the full minimum viable example.

Any suggestions why the user is not displayed properly in my frontend?

As I am trying to fix this error for several days now, I am looking forward to your replies!