I’m wondering if there is a better way of rendering my html without having to always have my files named differently. If there’s any way handlebars can know I want this file in this folder to be rendered rather than searching everywhere and having same-name conflicts..Any help would be appreciated. Here’s an example of code. Thank you!
//Setting up configuration views here //
const hbs = exphbs.create({ helpers, defaultLayout: 'main', extname: '.handlebars' });
app.engine('handlebars', hbs.engine);
//Handlebar files must be named differently //
app.set('views', [
path.join(__dirname, 'views/corporate'),
path.join(__dirname, 'views/help-center'),
]);
app.set('view engine', 'handlebars');
And then my view folder is
And here is an example of one of my routes
const router = require("express").Router();
const config = require("../../lib/config");
const { appUrl } = config;
router.get("/", (req, res) => {
res.render("corpIndex", {
appUrl
});
});
module.exports = router;