Skip to content

Commit

Permalink
feat(api): Adding recoverer middleware
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed May 16, 2021
1 parent b49ef56 commit 49f243a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,10 @@ Usage of api:
[prometheus] Shutdown Timeout {API_PROMETHEUS_SHUTDOWN_TIMEOUT} (default "5s")
-prometheusWriteTimeout string
[prometheus] Write Timeout {API_PROMETHEUS_WRITE_TIMEOUT} (default "10s")
-publicURL string
Public URL {API_PUBLIC_URL} (default "https://api.vibioh.fr")
-readTimeout string
[server] Read Timeout {API_READ_TIMEOUT} (default "5s")
-shutdownTimeout string
[server] Shutdown Timeout {API_SHUTDOWN_TIMEOUT} (default "10s")
-title string
Application title {API_TITLE} (default "I'm a teapot 🫖")
-url string
[alcotest] URL to check {API_URL}
-userAgent string
Expand Down
3 changes: 2 additions & 1 deletion cmd/goweb/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/ViBiOh/httputils/v4/pkg/logger"
"github.com/ViBiOh/httputils/v4/pkg/owasp"
"github.com/ViBiOh/httputils/v4/pkg/prometheus"
"github.com/ViBiOh/httputils/v4/pkg/recoverer"
"github.com/ViBiOh/httputils/v4/pkg/server"
)

Expand Down Expand Up @@ -74,7 +75,7 @@ func main() {
})

go promServer.Start("prometheus", healthApp.End(), prometheusApp.Handler())
go appServer.Start("http", healthApp.End(), httputils.Handler(appHandler, healthApp, prometheusApp.Middleware, owasp.New(owaspConfig).Middleware, cors.New(corsConfig).Middleware))
go appServer.Start("http", healthApp.End(), httputils.Handler(appHandler, healthApp, recoverer.Middleware, prometheusApp.Middleware, owasp.New(owaspConfig).Middleware, cors.New(corsConfig).Middleware))

healthApp.WaitForTermination(appServer.Done())
server.GracefulWait(appServer.Done(), promServer.Done())
Expand Down

0 comments on commit 49f243a

Please sign in to comment.