Package Exports
- @nxarch/ng-nest
- @nxarch/ng-nest/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nxarch/ng-nest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
A Nx plugin to integrate a NestJS server with a server side rendered Angular application.
From a conceptual view the NestJS server incorporates an Angular Universal application that will be reached on specified
routes.
The server uses the AngularUniversalModule provided by @nxarch/ng-universal.
The setup for both application can be tedious and error-prone. This library takes care of the entire setup and provides
an executor for a good DX.
Prerequisites
You need a NestJS application and a Angular application in the same workspace. Nx Version >= 14
Installation
npm i @nxarch/ng-nest
yarn add @nxarch/ng-nestSetup
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-projectApp Start
Use the added script in the package.json.
yarn dev:serverSetup 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:appConfiguration
For configuring the AngularUniversalModule refer to @nxarch/ng-universal
.
Notice
When using Angulars http client make sure to set a proper url.
// don't
hello$ = this.http.get<Message>('/api/hello');
// do
hello$ = this.http.get<Message>('http://localhost:4200/api/hello');