Home > Back-end >  Calling the same endpoint with multiple requests
Calling the same endpoint with multiple requests

Time:11-20

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.

CodePudding user response:

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

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

  • Related