I am trying to connect my Angular app with a simple REST server on express. The server only sends json data in reply to request. To add CORS suppor
json
CORS
In case you are using angular-cli, you can use a proxy:
proxy.conf.json:
{ "/api": { "target": "http://localhost:8888", "secure": false } }
Will redirect all requests with /api prefix to localhost:8888 without any cors issue.
/api
Offical docs: https://angular.io/guide/build#proxying-to-a-backend-server