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

288
Views
Query param en Nestjs: I want to make a service that allows you to filter the books by categories ,

I am trying to create a service to be able to filter the books by categories,I can't get the query parameter to the book service

Book controller

@ApiTags('books')
@Controller('book')
export class BookController {
  constructor(private readonly getBook: GetBookApi) {}
 @Get()
  @ApiOperation({
    description: 'Return Books from Api',
  });
  async findAll(@Query() input:GetBookInputDto):Promise<BookDTO[]> {
    return await this.getBook.category(input.category);
  }
}

But I can't get the query parameter to the book service

// Book Service
@Injectable()
export class BookService {
  constructor(private readonly client: BookClient) {}
  async getCategorys(): Promise<Book[]> {
    const result = await this.client.get();
   if (result && result.data && !result.data.error) {
      return BookAdapter.mapperBookResponse(result.data);
    } else {
      throw new UnauthorizedException('Error getting 
 identifiers 
  ');
    }
  }
}

here I have the client book where I have the url using axios

 async get() {
  const host = 'http://www.etnassoft.com/api/v1/'
  const path = 'get?category=libros';

  const newInstance = axios.create({
  
  baseURL: host,
  timeout: 10000,
  headers: {
    Accept: 'application/json',
   },
  });

 const request: AxiosResponse = await newInstance({
  method: 'get',
  url: path,
 });
  return request;
 }
 }
about 4 years ago · Juan Pablo Isaza
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!