Trying to pull values with parameters in angular

Discussão em 'Angular' iniciado por Venkat, Fevereiro 13, 2025.

  1. Venkat

    Venkat Guest

    I'm trying to pass datas from "http://169.38.82.132:94/GetFarmerInfo" to "http://localhost:4200/". In this url "http://169.38.82.132:94/GetFarmerInfo" am trying to pass parameters as "authorisation and instance name" so my config file is:

    {
    "/api": {
    "target": "http://169.38.82.132:94",
    "secure": false,
    "Authorization": "bearer uRf0e8upueR4qTh_HSjzF9KiVxuXN8qK4UqHZez4LdX7DYZOsee4h0Fq1PupKGTFEIzbjq9gjiaVOtPeoayIh212nDyHOEilH2chHeXz4pXzAb8YLC4aJZ0WAEOmq0werPUeaS5c5frXo_P3iwXFtTezCxsYRkNnrXoLOfkHJsxRGW91m19EqzQgqcY5q6jQUQRZeXB9KYpI6THLLnED7ZQDNJZgTjdcuKCb-Gmb1XHD_L_V_BDlbuaEcjH3Qx52f2wOsmtyWGGQEjRMfOFtpO3KJFFmpEIVH0WxsRl5L-eg7S21i_tuT1rDQMdapXiS",
    "InstanceName":"ORISSA",
    "pathRewrite": {
    "/": ""
    }
    },
    "logLevel": "debug"

    }


    and my service file is:

    import { Injectable } from '@angular/core';
    import { HttpClient } from '@angular/common/http';
    import { Observable } from 'rxjs';

    @Injectable({
    providedIn: 'root'
    })
    export class PeopleService {

    constructor(private http:HttpClient) { }

    fetchPeople(): Observable<Object>{

    return this.http.get('/GetFarmerInfo');

    };

    }


    After run npm start am getting response as "GET http://localhost:4200/GetFarmerInfo 404 (Not Found)". Is there any other way to pass parameters?

    Continue reading...

Compartilhe esta Página