CAP
CAP

Reputation: 140

Calling the same endpoint with multiple requests

I'm in the process of deprecating an old API and want two (or multiple) requests to call the same endpoint. Something like this:

@Get('/request')      // call endpoint with this request
@Get('/otherRequest') // or with this request
test() {
  // do something
}

Clearly another way to do this would be to create another endpoint and use a service to share the functionality, but I am curious if this is possible as it would make the process easier to implement.

Upvotes: 0

Views: 1974

Answers (1)

Micael Levi
Micael Levi

Reputation: 6665

@Get(['/request', '/otherRequest'])
test() {
  // do something
}

tip: inspect the TS types of @Get() ^^

Upvotes: 2

Related Questions