Q36: What are Express Sub-Apps and how do they differ from Routers?
An Express sub-app is created by instantiating a separate express() application instance and mounting it onto a parent application via app.use('/prefix', subApp).
Unlike express.Router(), a sub-app possesses its own independent configuration settings (subApp.set()), engines, and custom event emitters (mount event).
Key Takeaways
- Sub-apps maintain their own independent settings via
subApp.set(). - Use Routers for basic path grouping; use sub-apps when mounting self-contained modules needing distinct configurations.