Getting ready

To complete this recipe, we will need to switch to history mode. History mode only works when the app is running on a properly configured server. How to configure a server for SPA is out of the scope of this book (but the principle is that every route gets redirected from the server side to index.html).

We will use an npm program to launch a small server; you are expected to have npm installed (you can take a look at the Choosing a development environment recipe to find out more about npm).

Get Vue.js 2 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.