I followed the official tutorials and made services for the Apis but absolute url of the Api is hardcoded in services.
I want to keep the base url of Api somewhere s
You can create an Interceptor to add the base API URL
@Injectable()
export class CustomHttpInterceptor implements HttpInterceptor {
intercept(request: HttpRequest, next: HttpHandler): Observable> {
console.log('Custom Interceptor');
// Adding serverHostURL to all APIs in Interceptor
const serverHostURL = 'http://localhost:8080';
request = request.clone({
url: serverHostURL + request.url
});
return next.handle(request);
}
Above code should do.