I have a problem with getting data from my node.js server.
The client side is:
    public getTestLines() : Observable<TestLine[]> {
    let headers = new Headers({ 'Access-Control-Allow-Origin': '*' });
    let options = new RequestOptions({ headers: headers });
    return this.http.get('http://localhost:3003/get_testlines', options)
                .map((res:Response) => res.json())
                .catch((error:any) => Observable.throw(error.json().error || 'Server error')); 
}
in server side I also set the headers:
resp.setHeader('Access-Control-Allow-Origin','*') 
resp.send(JSON.stringify(results))
But I get an error
"XMLHttpRequest cannot load http://localhost:3003/get_testlines. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access."
How can I fix it? When I remove headers it says that this header is required.
 
     
     
     
     
     
     
    