Skip to main content

@ensono-stacks/azure-node

Configures your NodeJS application to use various Azure services:

Setting up @ensono-stacks/azure-node

Install the @ensono-stacks/azure-node with the following command:

npm install --save-dev @ensono-stacks/azure-node@latest

Executors and Generators

To see a list of the plugin capabilities run the following command:

nx list @ensono-stacks/azure-node

View additional information about a plugin capability through the following command:

nx g @ensono-stacks/azure-node:[generator-executor-name] --help

Generators

@ensono-stacks/azure-node:app-insights

Installs and configures App Insights in your NodeJS app.

This generator will add and configure applicationinsights npm package for you.

Prerequisites

  • Requires a NodeJs server for application insights to hook into.
tip

Use the @nrwl/next:custom-server generator which will have been added to your workspace by @ensono-stacks/workspace` to generate your NodeJS server!

  • It requires the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable to be set.
warning

There is a known issue with the @nrwl/next:custom-server impacting customServerTarget when typescript libraries are present in the monorepo. Please check the following Github Issue for the status of this issue.

Usage

nx generate @ensono-stacks/azure-node:app-insights

Command line arguments

The following command line arguments are available:

OptionDescriptionType
--projectTarget project name.string
--appInsightsKeyThe env variable that stores the app insights key.string
--serverPath to custom server file inside the project.string

Generator Output

  • Adds applicationinsights dependency in package.json.
  • Extends main() function in the server file to initialise and configure app insights.