Last active
May 31, 2019 16:09
-
-
Save Duncanian/b922c91fed5794191b58292693c70334 to your computer and use it in GitHub Desktop.
All routes for go-rest-api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
initEvents() | |
router := mux.NewRouter().StrictSlash(true) | |
router.HandleFunc("/", homeLink) | |
router.HandleFunc("/event", createEvent).Methods("POST") | |
router.HandleFunc("/events", getAllEvents).Methods("GET") | |
router.HandleFunc("/events/{id}", getOneEvent).Methods("GET") | |
router.HandleFunc("/events/{id}", updateEvent).Methods("PATCH") | |
router.HandleFunc("/events/{id}", deleteEvent).Methods("DELETE") | |
log.Fatal(http.ListenAndServe(":8080", router)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment