Angular json Server

40 Views Asked by At

I was trying to get the data from a json file (which is on the remote server) from localhost and I am getting error sign-up:1 Access to XMLHttpRequest at 'http://localhost:3000/user' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.

this.loginService.userRegister(user_dto).subscribe((data: any) => { alert('User registered successfully'); this.router.navigateByUrl('/sign-in'); }); userRegister(user_dto: any): Observable<any> { return this.apiService.post(this.reg_url + '/user', user_dto); }

0

There are 0 best solutions below