when using templating engines, you have to install them. The templating engine used in this tutorial is the hbs or handlebars. To install them run the command
npm install hbs --savethe —save makes sure that it is added to our package json as a dependency.
you dont need to require the package once its installed cuz express has a special way of loading these files. You just need to tell express the kind of templating engine you will be using.
In your server.js, right where you create an instance of the express app, type the command
app.set('view engine', 'hbs')After that, go ahead and create the “views” directory because that is where the template files will be loaded from. Once that is done, come inside your server.js and type the command
app.set("views", path.join(__dirname, "views"));remember that we use the path.join to get the absolute path to the particular directory(views)