Playing with axios - Part 1
It’s often the case that I start doing one thing and end up falling down a rabbit hole of interesting articles. Today, I was reading an e-mail from Codeship, and ended up reading through an article on their site Consider VueJS for Your Next Web Project.
At the end of that article I spotted recommendation that axios was the recommended way to make http requests within Vue.js, and so it was that I spent this morning having a quick play with axios.
axios is a really clean way of making http requests, and I was pretty impressed with how easily I could get a simple CodePen.io page up and running. I didn’t need anything other than the README.md on the axios GitHub repository to get something up and running.
My Codepen example makes use of the Pokemon API…my goto free API if I want to try something out. It’s sets up some base url config, makes a GET request for a specific pokemon, and then writes some stuff to the console.
See the Pen axios - simple pokemon api example by Martin Peck (@martinpeck) on CodePen.
It’s hardly the most comprehensive example of axios in action, but I hope you can see how simple it is to use axios and how readable the code looks.
I’ll be playing with this more in the future.