Angular Universal: real app problems

Igor Katsuba
IT’s Tinkoff
Published in
9 min readMar 18, 2021

--

Angular Universal is an open-source project that extends the functionality of @angular/platform-server. The project makes server-side rendering possible in Angular.

Angular Universal supports multiple backends:

  1. Express
  2. ASP.NET Core
  3. hapi

Another package Socket Engine is a framework-agnostic that theoretically allows any backend to be connected to an SSR-server.

This article will discuss the issues and possible solutions we encountered while developing a real application with Angular Universal and Express.

How Angular Universal Works

For rendering on the server, Angular uses the DOM implementation for node.js — domino. For each GET request, domino creates a similar Browser Document object. In that object context, Angular initializes the application.

The app makes requests to the backend, performs various asynchronous tasks, and applies any change detection from components to the DOM while still running inside node.js environment. The render engine then serializes DOM into a string and serves up the string to the server. The server sends this HTML as a response to the GET request. Angular application on the server is destroyed after rendering.

--

--

IT’s Tinkoff
IT’s Tinkoff

Published in IT’s Tinkoff

Tinkoff.ru creates a convenient and safe financial ecosystem. We guess the needs of users and break stereotypes about banking products — that is how we make them understandable and enjoyable.

Responses (1)