I want to remove my local server prefix from my REST API URLs (example, http://localhost:8080) when building for production (ng build --prod
).
I get that i
You will find the URL configuration in environment.ts and environment.prod.ts file. Don't put hardcoded URL while calling the API. A good practice is to read the API URLs from environment.ts and environment.prod.ts file
For the local environment use environment.ts
export const environment =
{
production: false,
API_URL: 'http://localhost:8080',
};
For the production environment use environment.prod.ts
export const environment =
{
production: true,
API_URL: 'http://api.productionurl.com',
};