json-server is not loading the products data.
compilation of the data happened successfully.
connection to the database not happening at all
get methods are undefined in browser console code.
how to fix this fetch error
json-server is not loading the products data.
compilation of the data happened successfully.
connection to the database not happening at all
get methods are undefined in browser console code.
You’re trying to fetch __rules
route which doesn’t exist. You need to create one.
That’s all I can tell from the info you provided.
please tell me the path where i have to create the rules route.
so that it can fetch the data
Show the server code. It’s impossible to give any advice based on two non-relevant screenshots.
here is the api.service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class ApiService {
private SERVER_URL = 'http://localhost:3000/products';
constructor(private httpClient: HttpClient) { }
// tslint:disable-next-line:typedef
public get() {
return this.httpClient.get<any[]>(this.SERVER_URL);
}
}
and here is the link to the github
to find out more about the rest of the files and code
First, you could try to fetch /products
instead of __rules
.
tried in browser console after reloading still undefined.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.