Instead of hard coding http://localhost:8080/api to call the backend.
Here's a tips to how to proxy to backend server only for developement, I don't know if there an alternative for production environement:
First you create a file : proxy.conf.json
when you specify your endpoint,
{ "/api/*": { "target": "http://localhost:8080", "secure": false, "logLevel": "debug", "changeOrigin": true }}
Then you launch you server like ng serve --proxy-config proxy.conf.json
or you can speficy that on your package.json in "start" then npm start.
Aucun commentaire:
Enregistrer un commentaire
to criticize, to improve