akanshSirohi / Github-Cards-API

Github readme cards api
https://afraid-ninnetta-github-cards.koyeb.app
19 stars 39 forks source link

Created fun_facts.js #80

Closed Sandeepdwivediii closed 1 month ago

Sandeepdwivediii commented 1 month ago

Summary of Adding the Fun Facts Card Setup and Initialization:

Started with an Express.js application and ensured the necessary dependencies were installed. Creating the Fun Facts Data Structure:

Created an array to hold fun facts, structured as objects with properties: index, quote, and author. Defining a New Route:

Added a new route in your Express application (e.g., funFacts.js). This route serves the fun facts as a JSON response when accessed. Implementing the Fun Fact Retrieval:

Developed a function within the route to handle GET requests, returning a specific fun fact or all fun facts based on the index. Integration with the Frontend:

Connected the backend route to the frontend, ensuring that when the user interacts with the UI, it fetches and displays the fun facts from the server. Testing the Functionality:

Tested the new route and functionality by accessing it through a web browser or API testing tool (like Postman) to confirm it returns the expected fun facts in the desired format.