Welcome to Highlight
Getting Started
Overview
Backend / Server
Client / Frontend
Fullstack Frameworks
Tips
Content-Security-Policy
Local Development
Monkey Patches
Performance Impact
Proxying Highlight
Session Search Deep Linking
Troubleshooting
Upgrading Highlight
Session Replay
Console Messages
HTML iframe Recording
Identifying Users
Live Mode
Network DevTools
Privacy
Rage Clicks
Recording Network Requests and Responses
Session Sharing
Session Shortcut
Tracking Events
Versioning Sessions
Error Monitoring
Grouping Errors
Sourcemaps
Versioning Errors
Product Features
Alerts
Analytics
Canvas
Comments
Environments
Frontend Observability
Keyboard Shortcuts
Performance Data
Segments
Session Search
Team Management
User Feedback
Web Vitals
WebGL
Integrations
Amplitude Integration
Clearbit Integration
Electron Integration
Front Plugin
Intercom Integration
Linear Integration
Mixpanel Integration
React.js Integration
Segment Integration
Sentry Integration
Slack Integration
Vercel Integration
highlight.run Changelog
5.0.0
5.0.1
5.1.0
5.1.1
5.1.2
5.1.3
5.1.4
5.1.5
Menu
Docs / Getting Started / Backend / Server / Express Backend

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.