sam-wach
v1.0.1
Published
README for Sam Class Implementation This README provides an overview of the Sam class implemented in index.js, which utilizes the Axios library to make HTTP requests to various APIs. Overview The Sam class is designed to interact with two specific APIs
Downloads
3
Readme
README for Sam Class Implementation This README provides an overview of the Sam class implemented in index.js, which utilizes the Axios library to make HTTP requests to various APIs. Overview The Sam class is designed to interact with two specific APIs:
- Nationalize.io API: This API guesses the nationality of a name provided.
- The Cat API: This API provides random cat images. Features Guess Nationality: By providing a name, the class can guess the nationality using the Nationalize.io API. Get Cat Images: Fetch random cat images from The Cat API. Error Handling: Both methods within the class are equipped with try-catch blocks for error handling. Installation Before using the Sam class, ensure you have Axios installed in your project. If not, you can install it using npm: Usage Here's how you can use the Sam class in your project: Importing the Class First, import the Sam class from index.js: Creating an Instance Create an instance of the Sam class: Guessing Nationality To guess the nationality of a name: Getting Cat Images To get a random cat image: Error Handling Both methods guesNationality and getApiData return the error directly in case of a failure. Ensure to handle these errors appropriately in your implementation. Dependencies Axios: Promise based HTTP client for the browser and node.js.