Skip to content

How to do have the same endpoints for multiple methods ? #1975

Answered by RobinTail
JonathanCabezas asked this question in Q&A
Discussion options

You must be logged in to vote

The documentation says we can have the same endpoint handle multiple methods:

yes, you can, @JonathanCabezas ,
all you need to make it possible is to set methods property with an array of ones when you do factory.build() (instead of method).

const yourEndpoint = yourFactory.build({
  methods: ["get", "delete"],
  /** other stuff and your implementation */
});

And then you can assign that endpoint both to get and delete prop of DependsOnMethod::constructor as in your original request. The handler of that endpoint will handle both methods of the same requested path. I hope it helps.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@JonathanCabezas
Comment options

@RobinTail
Comment options

@JonathanCabezas
Comment options

Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants