Chapter 11. Communicating with a server
This chapter covers
- Using Nuxt.js for server-side rendering
- Retrieving third-party data with Axios
- Using VuexFire
- Adding authentication
We’ve discussed Vuex and how state management can benefit our larger Vue.js applications. Now we’re going to look at communicating with a server. In this chapter, we’ll look at server-side rendering (SSR) and how we can use it to help improve our app’s responsiveness. We’ll use Axios to retrieve data from a third-party API. Then we’ll look at VuexFire. VuexFire is library that helps us communicate with Firebase, a backend service that helps with application development. Last, we’ll see how to add simple authentication to our VuexFire app.
Before we move on, let me preface this chapter by saying there are many ways to communicate with a server in Vue.js. We could use an XMLHttpRequest or use any number of AJAX libraries out there. In the past, Vue officially recommended the Vue resource library as the official AJAX library. Evan You, the creator of Vue, retired the library in late 2016 from official recommendation status. As far as the Vue community goes, you can use whatever library you like.