Koa
Lightrun for Koa🔗
To use Lightrun with a Koa application:
-
In your project's folder, install the node agent by running
npm install lightrun. -
Import Lightrun at the start of your application file (for example,
app.js) by adding the following code:require('lightrun').start({ lightrunSecret: '<LIGHTRUN_SECRET>' }); -
Run the application, e.g.,
node index.jsornpm start.
Getting Company Details
To get your <LIGHTRUN_SECRET> key, log into the Management Portal and inspect the Set Up An Agent section, under Getting Started.
Running the agent in TypeScript applications🔗
Important
As part of Lightrun’s commitment to align with industry standards, we strongly advise using the TypeScript Compiler (tsc) and not ts-node in production environments. This choice not only ensures a more efficient memory footprint but also avoids generating unnecessary type information.
It's essential to note that when utilizing Lightrun for TypeScript in a production setting, you must include sourcemap files on the server where your production software is deployed. This step is crucial for seamless debugging and troubleshooting.
Instructions
-
Insert the following code at the start of your application file (for example,
index.tsorapp.ts).import * as lightrun from 'lightrun'; lightrun.start({ lightrunSecret: '<LIGHTRUN_SECRET>', filename: <full_path_to_metadata_file> });Info
The
filenameparameter is optional. See here for details on constructing the metadata file. -
In the
compilerOptionssection of thetsconfig.jsonfile, set the parameter"sourceMap"to"true". -
From a terminal, run the application.
node index.js