axios-client-builder
v0.0.1
Published
Helper library to build consistent HTTP clients using axios
Downloads
3
Readme
Getting Started
Installation
npm i axios-client-builder
Usage
import { ClientBuilder } from 'axios-client-builder';
const client = new ClientBuilder({
config: { baseURL: env.getUrl() }, // OPTIONAL Axios config object
})
.addDefaultHeader(key, value)
.addErrorHandling(statuses[], fn[])
.addRequestLogging(logger) // Log requests and timing of requests
.addErrorLogging(logger) // Log any request error that does not match axios validateStatus
.addAuthorization(() => createAuthSignature()) // Add a dynamic auth on each request
.build();
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Contact
Alex Burley - @burlzad - [email protected]
Project Link: [https://github.com/alexburley/axios-client-builder](https://github.com/alexburley/axios-client-builder