Alquien me podria ayudar tengo un problema. Pero no lo puedo interpretar.
user.service.ts
postUser(user:User):Observable<User[]>{
let body = JSON.stringify(user);
let headers = new HttpHeaders({
'Content-Type': 'application/json'
});
return this._http.post<User[]>(this.listaUserURL, body, { headers })
//.pipe(map( res => {return res}));
.pipe ();
}
usuario.component.ts
saveUser() {
this._appUserService.postUser(this.user)
.subscribe((data :User[]) => {console.log(data)});
}
ERROR Este es el error que me sale
Access to XMLHttpRequest at 'http://localhost:3000/user' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.