×

Html & Html5

The World's best Software Development Study Portal




Node Js Path Connection:



Now create a view folder if you wants to use hbs
inside view create
index.hbs
register.hbs
npm i hbs
//install hbs package from terminal
Before moving ahead change the name of view to templates. And then create
a folder view and partials. And move your all files from templates to views.
Now make changes in app.js to connect index.hbs and register.hbs
const template_path=path.join(__dirname,"../templates/views")
app.set("view engine", "hbs");
app.set("views", template_path);
If You wants to include navbar in all page then create a folder
create a file navbar in partials folder then connect it to app.js
const hbs = require("hbs");
hbs.registerPartials(partials_path);