Angular 4 universal app with @angular/cli

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

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

Éverton Roberto Auler

Written by

Developer/Entrepreneur

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade