Creating recoverPanic method inside our middleware.go file and use it inside routes.go wrapping our router.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 59s

This commit is contained in:
Maxime Delporte
2025-10-23 14:19:53 +02:00
parent 2124f2f882
commit 7057f89038
2 changed files with 26 additions and 1 deletions

View File

@@ -26,5 +26,6 @@ func (app *application) routes() http.Handler {
router.HandlerFunc(http.MethodGet, "/v1/movies/:id", app.showMovieHandler)
// Return the httprouter instance.
return router
// Wrap the router with the panic recovery middleware
return app.recoverPanic(router)
}