Prerendering Angular application
What is prerendering and how Angular Universal supports it? This lesson will answer that questio and show you what steps you need to take, to make your application prerenderable.
Prerendering#
You've already added the script to run pre-rendering of your application by executing the ng add @nguniversal/express-engine
schematics. The problem is that it's not working with more sophisticated applications. Try to run it:
npm run prerender
As you can see, you've run into several issues. Some dependencies are missing in the Dependency Injection mechanism:

Terminate the rendering process.
The point is that the pre-rendering mechanism does not launch your application through the server.ts
file; it does not even launch the server. Because of that, providers passed to the ngExpressEngine
function are not applied. You need to provide them inside the src/app/app.server.module.ts file. Add the following imports statements at the top of this file:
import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens';
import { dbClient } from '../../api';
And provide services and tokens that are missing: