Integrating Angular Universal
Angular Universal is an Angular library that enables an Angular CLI application to be rendered on the server. An SSR application increases the loading speed of an Angular application and improves the loading of the first page.To install Angular Universal in an existing Angular CLI application, we will use the following command of the Angular CLI:
ng add @nguniversal/express-engine
The previous command uses the ng add
command of the Angular CLI to install the @nguniversal/express-engine
npm package. The @nguniversal/express-engine
package is the heart of the Angular Universal library and consists of a Node.js Express web server at its core.When we execute the preceding command to install Angular Universal, we are not only installing the library but also modifying our Angular CLI workspace with the following files:
angular.json
: This creates new entries in thearchitect
section to build and enable our Angular Universal application. One of these entries is...