Angular Universal with NestJS Add server-side rendering to Angular with Nest.js

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.
Get Unlimited PRO Access

OR


*Enrollment provides full access to this course (and updates) for life.

Create a server module using Angular Universal with the NestJS schematic.

Nest Universal Schematic

Steps

Add Universal and Nest

command line
ng add @nestjs/ng-universal

npm run build:ssr
npm run serve:ssr

file_type_ng_component_ts server/main.ts
import { NestFactory } from '@nestjs/core';
import { ApplicationModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(ApplicationModule);
  app.setGlobalPrefix('api');
  await app.listen(process.env.PORT || 8080); // <-- update this line
}
bootstrap();

Questions?

Ask questions via GitHub below OR chat on Slack #questions