Angular 4 universal app with @angular/cli

Éverton Roberto Auler
1 min readMar 26, 2017

--

— — — — — — — — — — — — — — — — — — — — — — — — —

DEPRECATED!!!

Please follow the steps of my new post, it is simpler and more optimised!

— — — — — — — — — — — — — — — — — — — — — — — — —

Based on Rob Wormald’s Demo Repository, I decided to build it using @angular/cli.

Start the project

npm install -g @angular/cli@latest
ng new --style=scss cli-universal-demo
cd cli-universal-demo
npm install -D ts-node
npm install -S @angular/platform-server @angular/animations

Update src/app/app.module.ts

Create src/app/app.server.module.ts

Update src/tsconfig.app.json

Update tsconfig.json

Create a express.js server: src/server.ts

Update scripts on package.json

Try it out

npm run start

--

--