$ npm install @bondxge/config
import { ConfigModule } from '@bondxge/config';
imports : [
ConfigModule.forRoot('assets/config.json'),
]
import { CONFIG } from '@lbge/config'; CONFIG.find('yourKey');
import { Injectable } from '@angular/core';
import { HttpRequest, HttpInterceptor, HttpHandler, HttpEvent, HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { CONFIG } from '@bondxge/config';
import { tap } from 'rxjs/operators';
@Injectable()
export class BaseUrlInterceptor implements HttpInterceptor {
constructor() {
}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
req = req.clone({
url: CONFIG.find<string>('apiUrl') + req.url
});
return next.handle(req);
}
}