labstack/echo
Configure Scout in your Echo application in 1 minute or less
We recommending integrating the Scout Echo middleware in your Echo applications.
The Echo middleware will record key attributes for your API requests (such as client IPs and status codes).
The examples in this section assume that you already know how to initialise Scout in your Go applications. If you do not know how, or if you would like a refresher, click here.
- If your backend exposes APIs to your frontend application, start by initialising Scout in your frontend with the following configuration:
const SCOUT_PROJECT_ID = process.env.SCOUT_PROJECT_ID
Scout.init(SCOUT_PROJECT_ID, {
// any backend deployments should go here
tracingOrigins: ['localhost', 'your-app.com/backend'],
networkRecording: {
enabled: true,
recordHeadersAndBody: true,
},
// ... extra Scout configs
})
- Configure Scout in your Echo backend:
func main() {
scout.Init(
...
)
defer scout.Stop()
}
- Integrate the Echo middleware:
import (
...
scoutEcho "github.com/scout-inc/scout-go/middleware/echo"
)
func main() {
// ...
server := echo.New()
server.Use(scoutEcho.Middleware())
// ...
}