Displaying views with Express
A view is an external file used to describe the display that you want to view. Specific syntaxes have been created to program the view, for example, JADE or EJS syntaxes.
The res.render(name, obj)
method is used to display the name
view using any properties provided in the obj
object. The view is a file defined in the views
directory using JADE syntax or another.
One of the features of Express is to allow you to create views using the desired syntax. The JADE syntax is offered as standard by Express, but other syntax support libraries can be added with npm
.
The JADE syntax is, therefore, the one used by default in Express. It makes it possible to replace HTML tags with their tag (for example <h1>
simply becomes h1
), and the indentation of tags in the code makes it possible to specify their nesting. It is also no longer necessary to close the tag previously opened because the indentation allows you to see the nesting of the tags.
Note
...