October 2018
Intermediate to advanced
590 pages
15h 5m
English
Now, let's work on the last step, which is to use an HTTP client to communicate with the backend. We will use axios (https://github.com/axios/axios) for its simple promise-based API. Let's download it from CDN (https://unpkg.com/axios/dist/axios.min.js) and put it under the resources/static/ directory. The version we use here is v0.18.0.
Once the messages page (https://localhost:8080/messages) is opened, in order to show the existing messages as soon as possible, we will need to add the logic of retrieving messages to the created() life cycle hook of the Vue instance. And we will also need to modify the addMessage() method.
Here are the changes to the index.html file:
...<body> ... <script src="../axios.v0.18.0.min.js"></script> ...
Read now
Unlock full access