Skip to content

Commit

Permalink
Correctly install sentry handler
Browse files Browse the repository at this point in the history
  • Loading branch information
walterjgsp committed Sep 10, 2023
1 parent aae7e9d commit 6dda856
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions service/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package service

import (
"encoding/json"
sentryhttp "github.com/getsentry/sentry-go/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/wcodesoft/mosha-author-service/data"
Expand Down Expand Up @@ -31,7 +32,13 @@ func (as *AuthorService) GetPort() string {
// MakeHandler creates a handler for the service.
func (as *AuthorService) MakeHandler() http.Handler {
r := chi.NewRouter()
sentryHandler := sentryhttp.New(sentryhttp.Options{
Repanic: true,
})

r.Use(middleware.Logger)
r.Use(middleware.Recoverer)
r.Use(sentryHandler.Handle)
r.Get("/api/v1/author/all", as.listAllHandler)
r.Get("/api/v1/author/{id}", as.createGetAuthorHandler)
r.Post("/api/v1/author/delete/{id}", as.deleteAuthorHandler)
Expand Down

0 comments on commit 6dda856

Please sign in to comment.