func (phs *PuppyHandlerAndStorer) handleDelete(w http.ResponseWriter, r *http.Request) {
	id, err := strconv.Atoi(chi.URLParam(r, "id"))  
	if err != nil {
		http.Error(w, "Bad Request: "+invalidIDMsg, http.StatusBadRequest)
		return
	}
	err = phs.Storage.DeletePuppy(id)
	if err != nil {
		handleStorerError(w, err)
		return
	}
	render.JSON(w, r, "Puppy successfully deleted")
}
Implementing 4/4 methods of PuppyHandler: puppy handler for DELETE /api/puppy/{id}
package rest
import (
	"net/http"
	"strconv"
	"github.com/anz-bank/go-course/10_rest/nickolee/pkg/puppy"
	"github.com/go-chi/chi"
	"github.com/go-chi/render"
)
const (
	invalidIDMsg   = "Invalid input, ensure ID is valid"
	invalidJSONMsg = "Invalid input, ensure JSON is valid"
)
type PuppyHandlerAndStorer struct {
	Storage puppy.Storer  
}
func NewPuppyHandlerAndStorer(s puppy.Storer) *PuppyHandlerAndStorer {
	return &PuppyHandlerAndStorer{Storage: s}
}
func handleStorerError(w http.ResponseWriter, err error) {
	switch e := err.(type) {  
	case *puppy.Error:
		http.Error(w, e.Error(), e.Code)
		return
	default:
		http.Error(w, "500: Internal Server Error", http.StatusInternalServerError)
		return
	}
}
func (phs *PuppyHandlerAndStorer) handleGet(w http.ResponseWriter, r *http.Request) {
	id, err := strconv.Atoi(chi.URLParam(r, "id"))  
	if err != nil {
		http.Error(w, "Bad Request: "+invalidIDMsg, http.StatusBadRequest)
		return
	}
	pup, err := phs.Storage.ReadPuppy(id)
	if err != nil {
		handleStorerError(w, err)
		return
	}
	render.JSON(w, r, pup)  
}
func (phs *PuppyHandlerAndStorer) handlePost(w http.ResponseWriter, r *http.Request) {
	var pup puppy.Puppy
	if err := render.DecodeJSON(r.Body, &pup); err != nil {
		http.Error(w, "Bad Request: "+invalidJSONMsg, http.StatusBadRequest)
		return
	}
	id, err := phs.Storage.CreatePuppy(&pup)
	if err != nil {
		handleStorerError(w, err)
		return
	}
	render.Status(r, http.StatusCreated)
	pup.ID = id             
	render.JSON(w, r, pup)  
}
func (phs *PuppyHandlerAndStorer) handlePut(w http.ResponseWriter, r *http.Request) {
	id, err := strconv.Atoi(chi.URLParam(r, "id"))  
	if err != nil {
		http.Error(w, "Unprocessable Entity: "+invalidIDMsg, http.StatusBadRequest)
		return
	}
	_, err = phs.Storage.ReadPuppy(id)
	if err != nil {
		handleStorerError(w, err)
		return
	}
	var pup puppy.Puppy
	if err := render.DecodeJSON(r.Body, &pup); err != nil {
		http.Error(w, "Unprocessable Entity: "+invalidJSONMsg, http.StatusUnprocessableEntity)
		return
	}
	err = phs.Storage.UpdatePuppy(id, &pup)
	if err != nil {
		handleStorerError(w, err)
		return
	}
	render.Status(r, http.StatusCreated)
	render.JSON(w, r, pup)  
}