O'Reilly logo

Mastering Web Application Development with Express by Alexandru Vlăduțu

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

Integrating a template engine with Express

In the remaining part of the chapter, we are going to integrate a template engine with Express, specifically the template function from the lodash module (this can be applied for other template engines too).

But what do we have to do exactly? We are going to tackle the following issues:

  • How the template engine's rendering function gets called (what arguments are called)
  • What the function should return
  • Caching and cache invalidation
  • Partials and layouts

The rendering function from Express calls the template engine function with the following arguments:

  • The path of the template file
  • The locals passed to the response.render function when called (as the second argument)
  • A callback function that should be called with ...

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