0
I am trying to get the data of the authenticated user, I read some things and I was trying, I was able to get all the user’s data but I can not only get information, as for example the name of the logged in user.
// Middleware
app.use((req, res, next) => {
res.locals.usuario = req.user
res.locals.success_msg = req.flash("success_msg")
res.locals.error_msg = req.flash("error_msg")
res.locals.error = req.flash("error")
res.locals.user = req.user || null;
next();
})
index js.
<h4>Categorias: </h4>
<hr>
{{usuario}}
{{#each categorias}}
<a href="/categorias/{{slug}}"> <h5>{{nome}}</h5></a>
{{else}}
{{/each}}
When I authenticate and enter the page informed below, appears all user information, I just wanted to take the name for example. What could I be missing?
I didn’t get it right, you want to take a person’s name in the middleware where the token is generated?
– Serginho junio
Yes, I had forgotten to leave the solution of this problem, I managed to solve today! Vlw ae anyway
– André Cabral