gin

command
v5.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 10 Imported by: 0

README

Gin integration

This is an example of a basic Gin app with Airbrake middleware that reports performance data (route stats).

How to run Example API

Insert your project ID and project key in the main.go file. You can find these values on the settings page for your project.

Initialise mod file

go mod init
go mod tidy

Run go application

go run main.go

The example application provides three GET endpoints:

  1. /date - gets the system date from the server
  2. /locations - gets the supported locations for use with the /weather endpoint
  3. /weather/{locationName} - gets the weather for a location; valid values for locationName can be found using the /locations endpoint

Use the cURL commands below to interact with the endpoints. The endpoints require an api-key HTTP header.

curl "http://localhost:3000/date" -H 'api-key: d4b371692d361869183d92d84caa5edb8835cf7d'
curl "http://localhost:3000/locations" -H 'api-key: d4b371692d361869183d92d84caa5edb8835cf7d'
curl "http://localhost:3000/weather/{austin/pune/santabarbara}" -H 'api-key: d4b371692d361869183d92d84caa5edb8835cf7d'
curl "http://localhost:3000/weather/boston" -H 'api-key: d4b371692d361869183d92d84caa5edb8835cf7d'

The last cURL is to get the 404 Not Found error

Once you call the API endpoints, view the Airbrake errors and performance dashboards for your project.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL