Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Beginning Server-Side Application Development with Angular
  • Table Of Contents Toc
Beginning Server-Side Application Development with Angular

Beginning Server-Side Application Development with Angular

By : Borggreve
close
close
Beginning Server-Side Application Development with Angular

Beginning Server-Side Application Development with Angular

By: Borggreve

Overview of this book

Equip yourself with the skills required to create modern, progressive web applications that load quickly and efficiently. This fast-paced guide to server-side Angular leads you through an example application that uses Angular Universal to render application pages on the server, rather than the client. You'll learn how to serve your users views that load instantly, while reaping all the SEO benefits of improved page indexing. With differences of just 200 milliseconds in performance having a measurable impact on your users, it's more important than ever to get server-side right.
Table of Contents (10 chapters)
close
close

Adding Dependencies for the Server App


In order to get our server app working correctly, we need to make sure we load two of Angular's dependencies: zone.js and reflect-metadata.

Our browser app loads these dependencies using polyfills.ts, and for the server app, we will add them to src/main.server.ts.

Another dependency that we need to add is the ModuleMapLoaderModule. This is a third-party module that is needed to make Angular Universal apps work with lazy loading.

We will import two dependencies in src/main.server.ts so that they are imported when the AppServerModule is loaded.

Additionally, we will enable production mode, just like it's done for the browser app in src/main.ts:

  1. Open the newly created file src/main.server.ts.

  2. Add the imports at the top of the file:

    import 'zone.js/dist/zone-node';
    import 'reflect-metadata';
    
    import { enableProdMode } from '@angular/core';
    import { environment } from './environments/environment';
  3. Conditionally enable production mode, depending on the environment...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Beginning Server-Side Application Development with Angular
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon