Skip to content

Instantly share code, notes, and snippets.

@Alexisvt
Last active January 9, 2020 19:44
Show Gist options
  • Save Alexisvt/459ecc59ac25d1bdc94a35ea499094ae to your computer and use it in GitHub Desktop.
Save Alexisvt/459ecc59ac25d1bdc94a35ea499094ae to your computer and use it in GitHub Desktop.
Angular Universal Cheatsheet

General commands

How to add SSR support to any existing Angular App

The next command will add the neccesary logic to activate the SRR feature on any Angular app.

npx ng generate universal --client-project your-project-name 

To find the name of the app, you need to open the angular.json file and usually the first property of projects is the name of the your project.

How to get the Universal bundle

The next command will instruct the angular cli to build the app with SSR capabilities

npx ng run your-project-name:server

or use the command contained in the script property of the package.json

npm run build:server-app:prod

The result of this process will be the universal bundle that will be use to run our app with SSR capabilites

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment