JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q71751F
  • License MIT

A Nx Plugin to simplify and improve NestJS and Angular Universal integration and development.

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.

  NxArch on npm  

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-nest

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 script in the package.json.

yarn dev:server

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 .

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');