Updating MovieModel's Delete method from internal/data/movies.go file. Create the deleteMovieHandler function inside cmd/api/movies.go. Adding the route into routes.go to delete a movie.

This commit is contained in:
Maxime Delporte
2025-11-07 11:37:19 +01:00
parent 69651c58b7
commit 1270a3bda6
3 changed files with 55 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ func (app *application) routes() http.Handler {
router.HandlerFunc(http.MethodPost, "/v1/movies", app.createMovieHandler)
router.HandlerFunc(http.MethodGet, "/v1/movies/:id", app.showMovieHandler)
router.HandlerFunc(http.MethodPut, "/v1/movies/:id", app.updateMovieHandler)
router.HandlerFunc(http.MethodDelete, "/v1/movies/:id", app.deleteMovieHandler)
// Return the httprouter instance.
// Wrap the router with the panic recovery middleware