Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Server-Side Enterprise Development with Angular

You're reading from   Server-Side Enterprise Development with Angular Use Angular Universal to pre-render your web pages, improving SEO and application UX

Arrow left icon
Product type Paperback
Published in Nov 2018
Publisher
ISBN-13 9781789806267
Length 142 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Bram Borggreve Bram Borggreve
Author Profile Icon Bram Borggreve
Bram Borggreve
Arrow right icon
View More author details
Toc

Introduction

In this chapter, we will add server-side rendering to the application that we built in the previous chapter. We will use ng generate to add Angular Universal to our application, and add a few commands to package.json so that we can build the whole app in a single command.

We will implement a simple Node.js server based on NestJS. This server will compile and serve our application when requested so that the complete rendered app gets sent to the browser.

How does a Normal App Render?

First, let's take a look at how a normal Angular application without server-side rendering behaves.

When we start the server in development mode using ng serve and use the View Source option in our browser to check the source, we can see that the only thing that gets rendered is the output from file src/index.html file, with a few scripts appended at the bottom.

These scripts will be downloaded by the browser and after they have been downloaded and executed, the application...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime