Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
better way to write code when multiple query parameters are present

I've a controller xyz.controller.ts

@Get()
fetch(
 @Query('id') id: number,
 @Query('status') status: string, 
 @Query('country_id') countryId: number,
 @Query('state_id') stateId: number): Promise<any> {
     return await this.xyzService(id, status, countryId, stateId);
}

Is there any way to pass the query params as a single object instead of creating multiple function args?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

if you specify the key in the query, it will only return the value of that key, but if you just write @Query() query it will return the whole query object and then you can create a interface to give a type to the query object, @Query() query: IQuery

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!