NestJS

The below instructions will guide you through setting up your NestJS application and deploying it in two steps. Follow along to get your project up and running.

Installation guide

1

Install using your favourite package manager

npm i @appear.sh/introspector // or
yarn add @appear.sh/introspector // or
pnpm add @appear.sh/introspector
2

Add import into your main.ts file

Include registerAppear() directly in to your main.ts file. See example.

main.ts
import { registerAppear } from "@appear.sh/introspector/node"

registerAppear({
  apiKey: process.env.APPEAR_REPORTING_KEY,
  environment: process.env.NODE_ENV,
  serviceName: "User Service", // name of the service you're instrumenting        (optional)
})
3

Log into Appear to view entries

The introspector will begin reporting the structure of your API services when they're interacted with. Log into Appear with your credentials to view the services that appear. You may need to refresh the page periodically.


Example installation

import { NestFactory } from "@nestjs/core"
import { AppModule } from "./app.module"
import { registerAppear } from "@appear.sh/introspector/node"

registerAppear({
  apiKey: "test-key",
  environment: "test",
  reporting: { endpoint: process.env.COLLECTOR_URL },
})

async function bootstrap() {
  const app = await NestFactory.create(AppModule)
  const server = await app.listen(0)
  const port = server.address().port
  console.log(`Server started on port ${port}`)
}
bootstrap()

Configuration

To configure how the introspector reports your schemas to Appear, you can adjust in the file below.


If you have any queries or require support with the above instructions, please contact us.

Last updated

Was this helpful?