routes.go 746 B

1234567891011121314151617181920212223242526
  1. package routes
  2. import (
  3. "byom-infra-api/middleware"
  4. "github.com/gorilla/mux"
  5. )
  6. // SetupRoutes configures all the routes for the application
  7. func SetupRoutes(r *mux.Router) {
  8. // Add logging middleware
  9. r.Use(middleware.LoggingMiddleware)
  10. // SSH Key routes
  11. r.HandleFunc("/sshkey", GetSSHKeys).Methods("GET")
  12. r.HandleFunc("/sshkey/{id}", GetSSHKeyByID).Methods("GET")
  13. r.HandleFunc("/sshkey", CreateSSHKey).Methods("POST")
  14. r.HandleFunc("/sshkey/{id}", DeleteSSHKey).Methods("DELETE")
  15. // DNS routes
  16. r.HandleFunc("/dns", ListDNSRecords).Methods("GET")
  17. r.HandleFunc("/dns/{subdomain}", GetDNSRecordID).Methods("GET")
  18. r.HandleFunc("/dns", CreateDNSRecord).Methods("POST")
  19. r.HandleFunc("/dns/{id}", DeleteDNSRecord).Methods("DELETE")
  20. }