Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
const express = require("express");
const exphbs = require("express-handlebars");
const path = require("path");
const hbs = require("hbs");
const app = express();
const bodyParser = require("body-parser");
const viewpath = path.join(__dirname, "/templates/views");
const partials = path.join(__dirname, "/templates/partials");
app.set("view engine", "hbs");
app.set("views", viewpath);
hbs.registerPartials(partials);
app.use(express.static("public"));

app.get("/", (req, res) => {
  res.render("login");
});

app.get("/home", (req, res) => {
  res.render("index");
});

this is my code. Here Login index is a layout page and i have to pass a partail named Home with it. How to do that???

What I have tried:

I tried to send in {partails: "Home"} but it just displays the 'home' text
Posted
Updated 28-Jul-20 20:06pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900