API Reference
Error Monitoring
Getting Started
Welcome to Highlight
Integrations
Product Features
Session Replay
Tips
Menu

Express Backend

Highlight ships @highlight-run/node which can be installed alongside highlight.run for capturing backend errors in applications with Express backends.

Usage

The usage of this Backend SDK requires one of our Client SDKs to be installed, so please follow the instructions there if you have not done so.

The @highlight-run/node Package

First, import the package

yarn add @highlight-run/node
Copy
Adding Highlight to Express

Pass configurations into the errorHandler and Highlight is ready to go!

import { Highlight } from '@highlight-run/node' // or like this with commonjs const Highlight = require('@highlight-run/node') const app = express() // define any configurations needed // <https://docs.highlight.run/api/hinit#w0-highlightoptions> const highlightOptions = {} // initialize the handler const highlightHandler = Highlight.Handlers.errorHandler(highlightOptions) // This should be before any other error middleware and after all controllers app.use(highlightHandler) app.use('/error', () => { throw new Error('a fake failure was thrown') })
Copy
Verify

To validate your Highlight backend setup, you'll need to setup up a testing route handler that throws an error. See the block above for an example. Add some code to your frontend to make an HTTP request to /error. You should be able to view your frontend session making the request and find the error traceback in the errors page.

To view and resolve the recorded error, log into app.highlight.run and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.