app-insights
@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 @nx/next:custom-server generator which will have been added to your workspace by @ensono-stacks/workspace` to generate your NodeJS server!
- Requires the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable to be set.
warning
There is a known issue with the @nx/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:
| Option | Description | Type |
|---|---|---|
| --project | Target project name. | string |
| --applicationinsightsConnectionString | The env variable that stores the app insights connection string. | string |
| --server | Path to custom server file inside the project. | string |
Generator Output
- Adds
applicationinsightsdependency inpackage.json. - Extends
main()function in the server file to initialise and configure app insights.