Skip to content

Commit 49f243a

Browse files
committed
feat(api): Adding recoverer middleware
Signed-off-by: Vincent Boutour <[email protected]>
1 parent b49ef56 commit 49f243a

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,10 @@ Usage of api:
8888
[prometheus] Shutdown Timeout {API_PROMETHEUS_SHUTDOWN_TIMEOUT} (default "5s")
8989
-prometheusWriteTimeout string
9090
[prometheus] Write Timeout {API_PROMETHEUS_WRITE_TIMEOUT} (default "10s")
91-
-publicURL string
92-
Public URL {API_PUBLIC_URL} (default "https://api.vibioh.fr")
9391
-readTimeout string
9492
[server] Read Timeout {API_READ_TIMEOUT} (default "5s")
9593
-shutdownTimeout string
9694
[server] Shutdown Timeout {API_SHUTDOWN_TIMEOUT} (default "10s")
97-
-title string
98-
Application title {API_TITLE} (default "I'm a teapot 🫖")
9995
-url string
10096
[alcotest] URL to check {API_URL}
10197
-userAgent string

cmd/goweb/api.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/ViBiOh/httputils/v4/pkg/logger"
1818
"github.com/ViBiOh/httputils/v4/pkg/owasp"
1919
"github.com/ViBiOh/httputils/v4/pkg/prometheus"
20+
"github.com/ViBiOh/httputils/v4/pkg/recoverer"
2021
"github.com/ViBiOh/httputils/v4/pkg/server"
2122
)
2223

@@ -74,7 +75,7 @@ func main() {
7475
})
7576

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

7980
healthApp.WaitForTermination(appServer.Done())
8081
server.GracefulWait(appServer.Done(), promServer.Done())

0 commit comments

Comments
 (0)