O'Reilly logo

Node.js 6.x Blueprints by Fernando Monteiro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Restructuring the views folder using partials

Now we will make a major change to the structure of directories in the views folder: we will add an important Embedded JavaScript (EJS) resource for the creation of reusable files in our templates.

They are known as partial files and will be included in our application using the <% = include %> tag.

Tip

You can find more information about EJS on the official project page at: http://ejs.co/

Inside the views folder, we will create two more folders, called partials and pages:

  1. The pages folder will be as follows at this point:
  2. Now let's move the files that were in the views folder to the pages folder.
  3. Create a pages folder inside the views folder.
  4. Create a partials folder inside the views folder.
    • server/
    • pages/ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required