more file structure
This commit is contained in:
25
api/router/router.go
Normal file
25
api/router/router.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"vm-ctp/api/resource/common"
|
||||
"vm-ctp/api/resource/vm"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func New() *mux.Router {
|
||||
r := mux.NewRouter()
|
||||
|
||||
// If nothing more specific is requested then just display some version information
|
||||
r.HandleFunc("/", common.HomeLink)
|
||||
|
||||
s := r.PathPrefix("/api").Subrouter()
|
||||
s.HandleFunc("/event/vm/create", vm.VmCreateHandler).Methods("POST") // receive VM creation event from Direktiv
|
||||
s.HandleFunc("/event/vm/remove", vm.VmRemoveHandler).Methods("POST") // receive VM creation event from Direktiv
|
||||
|
||||
// Not found handler
|
||||
r.NotFoundHandler = http.HandlerFunc(common.HandleNotFound)
|
||||
|
||||
return r
|
||||
}
|
Reference in New Issue
Block a user