This is an example of a basic net/http app with Airbrake middleware that reports performance data (route stats).
Insert your project ID and project key in the main.go file. You can find these values on the settings page for your project.
Initialize mod file
go mod init
go mod tidyRun Go application
go run main.goThe example application provides three GET endpoints:
/date- gets the system date from the server/locations- gets the supported locations for use with the/weatherendpoint/weather/{locationName}- gets the weather for a location; valid values forlocationNamecan be found using the/locationsendpoint
Use the cURL commands below to interact with the endpoints.
curl "http://localhost:3000/date"
curl "http://localhost:3000/locations"
curl "http://localhost:3000/weather/{austin/pune/santabarbara}"To see how Airbrake error monitoring works, use an unsupported location, e.g. boston: curl "http://localhost:3000/weather/boston".
After issuing this request, the service will respond with a 404 Not Found error. Visit the Airbrake dashboard to see the error captured there.
Once you call the API endpoints, view the Airbrake errors and performance dashboards for your project.