“The things should work; the way we expect them to work; without surprises”
I’ve created a quote machine as a part of my course in freeCodeCamp. I’m always interested to read books and famous quotes which has some deep meaning, intellectual thoughts and sometimes some random ones.
This task is really interesting, the user stories are very simple.
- I can use whichever libraries or APIs I need. And I have some personal style.
- When I click a button it should show me a random quote.
- When I click a share button it should tweet the quote.
To complete this task, I’ve searched on the internet whether any free APIs are already there to give me a random quote. And I have got a bunch of links. I have picked an API from the top list and started adding into my code.
The API documentation provides sample request to query the API. It’s a getJSON sample which uses jQuery to run. So I have imported jQuery CDN in my HTML code.
Then I have created the button to trigger the API call to get Quotes. And created a tweet button with the help twitter official documentation. For some personal styling, I have added material CSS CDN to my code.
Earlier I have displayed the quotes in the normal div, then I have replaced it with material CSS cards.
That’s it! Quote Machine Ready 🙂
You can find the quote machine I have created below,
And also I have recorded the vlog when doing the quote machine coding task.
You find that below:
Check it out, and let me know thoughts in comment section.
Happy coding 🙂