HİNT to Set up a Template Engine

  1. First of all, we need to introduce template engine to the express so that he understands what template we are using.
    app.set ('view engine', 'pug');
    Express will automatically search for the pug file in the views directory.

  2. we need to make changes in the router.get () method for the index.pug file to work properly.
    Here we need to pass the relative path of the index.pug file as a parameter to the render () method.
    res.render ('./pug / index');

Given that express automatically looks at the views directory, then we need to write here./pug.index. This means render the index.pug file in the pug folder in the current (ie views) directory.

Challenge: Set up a Template Engine

Link to the challenge: