Which strategy ensures zero-downtime migration to Pug for existing Node.js views?
0 reputation · 29 Oct 2021, 19:35 UTC
Migrating View Engines in Node.js
A small application currently utilizing a standard HTML-based template engine needs to migrate to Pug to leverage its indentation-based syntax and reusable mixins. Because Pug requires a complete rewrite of view files rather than a simple syntax conversion, the migration cannot happen incrementally within a single file.
The primary constraint is maintaining 100% availability during the transition. Since the application serves live traffic, switching the view engine configuration globally in the application settings would cause an immediate failure for any views not yet converted to the .pug format.
What architectural approach allows for a phased rollout where both the legacy engine and Pug coexist during the transition? Does the Node.js environment support multiple view engines simultaneously based on file extensions?