Complete Vue.js 2 Web Development_ Practical guide to building end-to-end web development solutions with Vue.js 2

(singke) #1
Vue Communicates with the Internet Chapter 14

Add a new custom throttling called Everest with 1kb/s for download and upload and a


latency of 1,000 milliseconds, as in the following screenshot:


You can then select that type of throttling and try to order some pizzas. If you are lucky,
you should eventually be able to order some, thanks to the persistency of Axios.


If you are not getting success or if all your pizzas are ordered correctly, try to adjust the
parameters; much of this process is actually random and highly dependent on the machine.


How it works...


There are many ways to deal with flaky connections and there are many libraries out there


that integrate with Axios and have more advanced retry and reattempt strategies. Here, we


have seen only one basic strategy, but libraries such as Patience JS have more advanced
ones and they are not difficult to use.


Creating a REST client (and server!)


In this recipe, we will learn about REST and how to build a REST client. To build a REST
client, we will need a server that exposes a REST interface; we will build that also. Wait a


minute! A whole REST server is a side note in a recipe in a book about Vue? Just follow
along and you won't be disappointed.

Free download pdf