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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.