|
|
- package api
-
- import (
- "net/http"
-
- "github.com/gorilla/mux"
- )
-
- func InitApiEndpoints() *mux.Router {
- var (
- router *mux.Router
- )
-
- router = mux.NewRouter()
-
- // Define routes for pet api
- router.HandleFunc("/pet", PetHandlerCreateUpdate).Methods("POST", "PUT")
- router.HandleFunc("/pet/findByStatus", FindByStatusPetHandler).Methods("GET")
- router.HandleFunc("/pet/{petId}", GetPetHandler).Methods("GET")
- router.HandleFunc("/pet/{petId}", UpdatePetHandler).Methods("POST")
- router.HandleFunc("/pet/{petId}", DeletePetHandler).Methods("DELETE")
- router.HandleFunc("/pet/{petId}/uploadImage", UploadImagePetHandler).Methods("POST")
-
- router.PathPrefix("/").Handler(http.StripPrefix("/images/", http.FileServer(http.Dir("./uploads"))))
-
- return router
- }
|