sentry middleware
⚙️ gearbox requires version 1.14
or higher of Go (Download Go)
Just use go get to download and install gearbox
go get -u github.com/gogearbox/gearbox
go get u- github.com/gogearbox/sentry
package main
import (
"github.com/getsentry/sentry-go"
"github.com/gogearbox/gearbox"
sentrymiddleware "github.com/gogearbox/sentry"
)
func main() {
// Setup gearbox
gb := gearbox.New()
// Initialize sentry
_ = sentry.Init(sentry.ClientOptions{
Dsn: PROJECT_DSN,
})
// Register the sentry middleware for all requests
gb.Use(sentrymiddleware.New())
// Define your handler
gb.Post("/hello", func(ctx gearbox.Context) {
panic("There is an issue")
})
// Start service
gb.Start(":3000")
}