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

This commit is contained in:
Maxime Delporte
2025-11-07 11:27:45 +01:00
parent 490c3174ca
commit 69651c58b7
3 changed files with 82 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ func (app *application) routes() http.Handler {
router.HandlerFunc(http.MethodGet, "/v1/healthcheck", app.healthcheckHandler)
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)
// Return the httprouter instance.
// Wrap the router with the panic recovery middleware