Nest-Nguniversal
A Nx plugin to integrate NestJS server with a server side rendered Angular application.
Conceptually a NestJS server serves an Angular Universal application.
Besides serving the application NestJS functionality can be used as usual.
The server uses the AngularUniversalModule provided by @nxarch/ng-universal
Prerequisites
You need a NestJS application and a Angular application in the same workspace.
Installation
npm i @nxarch/nest-nguniversal
yarn add @nxarch/nest-nguniversal
Setup
Use the provided generator to setup all files. If you don't have an Angular and a NestJS app refer to this part on how to generate these applications.
yarn nx generate @nxarch/ng-nest:init --ssrApp=my-angular-project --serverApp=my-nestjs-project
App Start
Use the added target in the server configuration file.
yarn nx run my-nestjs-project:serve-ssr
Setup Nx apps (if not already setup)
Setup an Angular app and a NestJS app
yarn add --dev @nrwl/angular @nrwl/nest
yarn nx generate @nrwl/angular:app
yarn nx generate @nrwl/nest:app
Configuration
For configuring the AngularUniversalModule refer to @nxarch/ng-universal
.
Contributing
PRs accepted.
License
MIT © 2022 nxarch