When using the node.js template engine replace the suffix with.html
- 2020-06-01 08:17:05
This is a trick that always makes it uncomfortable to look at the.ejs suffix. You can use the following method to change the template file suffix to the.html one you are used to.
1. Define ejs on the head of app.js:
var ejs = require('ejs');
2. Register html template engine:
3. Replace the templating engine with html:
app.set('view engine', 'html');
4. Change the suffix of the template file to.html.
Ok, mission accomplished, ready to run and view!
That's all for this article, I hope you enjoy it.