I am using Nativescript sidekick cloud build on windows to test my app on iOS - I have also connected my iPhone.
According to this post I am sending my http requests to localhost but they keep failing with this error.
Http failure response for http://localhost:52553/api/rewards/all: 0 Unknown Error
Error: Could not connect to the server.
Here is my implementation of rewards service
import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { Observable, of } from 'rxjs';
import { SimpleReward } from "../models/simple-reward";
import { take, catchError } from "rxjs/operators";
@Injectable()
export class RewardsService {
private baseUrl = "http://localhost:52553/api/rewards";
constructor(private http: HttpClient) { }
getAllRewards(): Observable<SimpleReward[]> {
const url = `${this.baseUrl}/all`;
return this.http.get<SimpleReward[]>(url).pipe(
catchError((e) => {
console.error(e);
return of([]);
})
);
}
}
Please guide what I am doing wrong here?