Sometimes, we want to get Express to output nicely formatted HTML.
In this article, we’ll look at how to get Express to output nicely formatted HTML.
How to get Express to output nicely formatted HTML?
To get Express to output nicely formatted HTML, we set the app.locals.pretty option to true.
For instance, we write
if (app.get('env') === 'development') {
app.locals.pretty = true;
}
to set app.locals.pretty to true when our Express app is run in the dev environment.
Conclusion
To get Express to output nicely formatted HTML, we set the app.locals.pretty option to true.