1.0.1 • Published 2 years ago

@rbipin/httpclient v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

http-client

A wrapper over axios http client to make authentication and token management easier

Authors

Documentation

Use the HttpClientFactory to create a HttpClient.

The createClient method of the HttpClientFactory takes a HttpConfiguration object.

HttpConfiguration can be used to configure the HttpClient, like the base url the HttpClient should hit. If HttpConfiguration is not passed then the basic HttpClient is returned

Here is an example

 const httpConfig: HttpConfiguration = {
    baseUrl: 'http://localhost:3000',
    authConfig: null,
    headers: null,
    timeout: null,
    };

    const httpClientFac = new HttpClientFactory();
    const httpClient = httpClientFac.CreateClient(httpConfig);
    const response: HttpResponse<Data> = await httpClient.get('/posts/1');