I am using express Node backend and frontend for angular. the thing is when i was integrate my API to angular i had CORS problem. inside the developer console i have got a error like this "XmlHttpRequet cannot load http://localhost:3000/student No Access-Control-Allow-Origin"
I have tried to proxy the backend adding a proxy-confg.json inside the angular project. but the result also same. still have CORS problem.
// node js endpoint
ApienpointUrl = 'http://localhost:4200/stdApi/student';
// getting data from endpoint
getStudentfromMock() {
return this.http.get(this.ApienpointUrl).pipe(
map((res: any) => res),
catchError(this.handleError)
);
}
Here the Proxy configuration inside angular project proxy.conf.json
{
"/stdApi/*": {
"target": "http://localhost:3000",
"secure": false,
"logLevel": "debug",
"changeOrigin": true
}
}
i am getting error like this:-
"XmlHttpRequet cannot load http://localhost:4200/stdApi/student No Access-Control-Allow-Origin. header is present on the request resources origin 'http://localhost:3000' therefor not allowed access".