You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
756 B

3 years ago
3 years ago
3 years ago
  1. package api
  2. import (
  3. "net/http"
  4. "github.com/gorilla/mux"
  5. )
  6. func InitApiEndpoints() *mux.Router {
  7. var (
  8. router *mux.Router
  9. )
  10. router = mux.NewRouter()
  11. // Define routes for pet api
  12. router.HandleFunc("/pet", PetHandlerCreateUpdate).Methods("POST", "PUT")
  13. router.HandleFunc("/pet/findByStatus", FindByStatusPetHandler).Methods("GET")
  14. router.HandleFunc("/pet/{petId}", GetPetHandler).Methods("GET")
  15. router.HandleFunc("/pet/{petId}", UpdatePetHandler).Methods("POST")
  16. router.HandleFunc("/pet/{petId}", DeletePetHandler).Methods("DELETE")
  17. router.HandleFunc("/pet/{petId}/uploadImage", UploadImagePetHandler).Methods("POST")
  18. router.PathPrefix("/").Handler(http.StripPrefix("/images/", http.FileServer(http.Dir("./uploads"))))
  19. return router
  20. }