02 - Templating

// Templating:
// ===========
// Templating is used to reuse HTML code to display
// similar web pages. For Templating, we can use any
// of the various Templating engines like EJS, HandleBars, etc.

// here, we have installed ejs npm package,
    npm i ejs
// now, create folder "views" inside your project directory.
// and inside views, create home.ejs file.
home.ejs

// in case, we need to use any other 
// javascript or css files in home.ejs template file,
// we create a folder "public" in our project directory.

// inside public, we create two folders, "js" and "css"
// once done, put your js and css files in these two folders.

// then, after this add below to head tag of home.ejs:
 ⟨link rel="stylesheet" href="css/styles.css">
// and below at the end inside of body tag
 ⟨script src="js/script.js">⟨/script>

// Now, what if we want to use some part of our HTML code in
// multiple files, like we want the same Navbar to be shown
// in all our ejs UI/views files, Or if we don't want to 
// write the same head tag everytime in every ejs file.
// In such cases, we can use "partials" for this.
// create a folder "partials" inside views folder

// now, inside your partials folder, create templates
// which you want to reuse in your UI files in
// views folder. Like if we want the header and footer
// to be same across all our View files, then
// in partials folder, 
// create header.ejs and footer.ejs,
// now, use the header.ejs and footer.ejs code
// in your home.ejs and other files by including them
// as we did in home.ejs file
// using include: <%- include('partial/header') %>

// See in below index.js file on how we can use and work with ejs,
index.js