O'Reilly logo

Continuous Integration, Delivery, and Deployment by Sander Rossel

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

EJS

Now that we can serve files and HTML from our backend, we can use some sort of HTML template engine. Basically, I am pretty satisfied with the HTML files we have so far, except for the fact that the navigation bar at the top is duplicated in each file. We can do better than that. Express has built-in support for several templating engines, most notably Jade. On top of that, it is fairly easy to create your own templating engine. While Jade is pretty awesome, it has very clean and concise syntax, we are going to use EJS, or Embedded JavaScript (http://www.embeddedjs.com/). All we want to do is create some sort of partial view (the navigation bar) and insert that into our pages. EJS supports just that (and more):

npm install ejs --save ...

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