Answer the question
In order to leave comments, you need to log in
How to create a global User variable in Express.js that is available on all pages?
Hello, I am creating, for educational purposes, the registration and authorization process, on Next.js, React, Express. There was a task to display the user login on all pages of the site, I know that using a preprocessor, for example, EJS, you can write in the app.js file like this
res.render('index', {
user: {
id,
login
}
});
});
<%= user.login %>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question