Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
How can i render a partials from Node.js on all pages

So I need to render header.ejs in the partials folder, but I need it to be rendered by each page separately. That is localhost:3000/all and here to be rendered header.ejs next to the file dedicated to the page (all.ejs)

i wont like this:

app.get("/all", function (req, res) {
  Product.find({}, (err, product) => {
    if (req.isAuthenticated()) {
      User.findById(req.user.id, (err, user) => {
        res.render("all", {
          isLogIn: true,
          name: user.name,
          product: product,
        });
      });
    } else {
      res.render("all", {
        isLogIn: false,
        product: product,
      });
    }
  });
});

Thanks!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!