How to use HTML as the view engine in Express?

Sometimes, we want to use HTML as the view engine in Express.

In this article, we’ll look at how to use HTML as the view engine in Express.

How to use HTML as the view engine in Express?

To use HTML as the view engine in Express, we can use the expres.static method.

For instance, we write

app.use(express.static(__dirname + '/public'));

to call express.static with the path to the HTML files we want to serve.

We don’t need a view engine to render the HTML.

Conclusion

To use HTML as the view engine in Express, we can use the expres.static method.