Installation
Install the Express.js integration package:Basic Setup
Add ApiTraffic middleware to your Express application:Configuration Options
Advanced Usage
Custom Tagging
Add custom tags to requests for better organization:Custom Traces
Add trace messages for debugging:Error Handling
ApiTraffic automatically captures errors, but you can add additional context:Environment Variables
Configure using environment variables:.env
Middleware Order
Place ApiTraffic middleware early in your middleware stack:TypeScript Support
The package includes TypeScript definitions:Troubleshooting
Common Issues
Middleware not capturing requests
Middleware not capturing requests
Ensure ApiTraffic middleware is placed before your route handlers and after body parsing middleware.
Missing environment variables
Missing environment variables
Verify that
API_TRAFFIC_TOKEN
and API_TRAFFIC_BUCKET
are set in your environment.Outbound requests not being tracked
Outbound requests not being tracked
Set
interceptOutbound: true
in your configuration to enable outbound request monitoring.