Is there a method for passing URL parameters to the httpService in nestjs? I want to improve the readability of this URL without resorting to Axios as nest has its own HTTPModule
.
Currently, this is how it looks and functions:
const response = await this.httpService
.get(`https://api.github.com/users/${username}/repos?per_page=5&sort=created:asc&client_id=${process.env.GITHUB_ID}&client_secret=${process.env.GITHUB_SECRET}`,)
.toPromise();
I came across this syntax used in Angular, but it doesn't seem to be functioning correctly:
const response = await this.httpService.get(
`https://api.github.com/users/${username}/repos`,
params: {
per_page: 5,
sort: created:asc,
client_id: process.env.GITHUB_ID,
client_secret: process.env.GITHUB_SECRET
}).toPromise();
There must be a way to enhance the appearance of the code.