How to do have the same endpoints for multiple methods ? #1975
-
Hello, I've read the whole documentation and searched through issues/discussions but I can't find an example of this. The documentation says we can have the same endpoint handle multiple methods:
However I have no idea how such an endpoint would look like, could you please provide examples for the get/delete and post/patch endpoint sharing above ? Thank you for your framework, I find it extremely well designed and helpful to structure my project ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
yes, you can, @JonathanCabezas , const yourEndpoint = yourFactory.build({
methods: ["get", "delete"],
/** other stuff and your implementation */
}); And then you can assign that endpoint both to |
Beta Was this translation helpful? Give feedback.
yes, you can, @JonathanCabezas ,
all you need to make it possible is to set
methods
property with an array of ones when you dofactory.build()
(instead ofmethod
).And then you can assign that endpoint both to
get
anddelete
prop ofDependsOnMethod::constructor
as in your original request. The handler of that endpoint will handle both methods of the same requested path. I hope it helps.