added multiple method support for routes
This commit is contained in:
12
hws/doc.go
12
hws/doc.go
@@ -74,6 +74,18 @@
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// A single route can handle multiple HTTP methods using the Methods field:
|
||||
//
|
||||
// routes := []hws.Route{
|
||||
// {
|
||||
// Path: "/api/resource",
|
||||
// Methods: []hws.Method{hws.MethodGET, hws.MethodPOST, hws.MethodPUT},
|
||||
// Handler: http.HandlerFunc(resourceHandler),
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// Note: The Methods field takes precedence over Method if both are provided.
|
||||
//
|
||||
// Path parameters can be accessed using r.PathValue():
|
||||
//
|
||||
// func getUser(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user