This simple demo has an error https://docs.nestjs.com/techniques/http-module
import { Get, Controller, HttpService } fro
You cannot just return the whole AxiosResponse
object because it cannot be serialized to JSON. You most likely want to get the response data
like this:
@Get()
root() {
return this.http.get('https://api.github.com/users/januwA').pipe(
map(response => response.data)
);
}
or alternatively using Promises
:
@Get()
async root() {
const response = await this.http.get('https://api.github.com/users/januwA').toPromise();
return response.data;
}