I work with Angular for the frontend and Laravel's api for the backend.
When I'm developing a project, I have to set the route of laravel to localhost:8000/api to be able to do POST, GET, etc
Then when I'm done, I have to change the route to the one on the host page backend-folder/public/api
I use a service that is used so that all requests have the same base route
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class PathService {
constructor() {}
DataBasePath() {
return '/backend-folder/public/api';
// return 'http://localhost:8000/api';
}
}
The problem is that I always have to be changing the path when I'm developing it and when I have to deploy, sometimes I forget to do that and I have to build again with Angular
Is there a way that when I'm developing the path it's localhost:8000/api and when I deploy (ng build) the path changes to backend-folder/public/api?