Book Image

Building Applications with Spring 5 and Vue.js 2

By : James J. Ye
Book Image

Building Applications with Spring 5 and Vue.js 2

By: James J. Ye

Overview of this book

Building Applications with Spring 5 and Vue.js 2, with its practical approach, helps you become a full-stack web developer. As well as knowing how to write frontend and backend code, a developer has to tackle all problems encountered in the application development life cycle – starting from the simple idea of an application, to the UI and technical designs, and all the way to implementation, testing, production deployment, and monitoring. With the help of this book, you'll get to grips with Spring 5 and Vue.js 2 as you learn how to develop a web application. From the initial structuring to full deployment, you’ll be guided at every step of developing a web application from scratch with Vue.js 2 and Spring 5. You’ll learn how to create different components of your application as you progress through each chapter, followed by exploring different tools in these frameworks to expedite your development cycle. By the end of this book, you’ll have gained a complete understanding of the key design patterns and best practices that underpin professional full-stack web development.
Table of Contents (23 chapters)
Title Page
Copyright and Credits
Dedication
About Packt
Contributors
Preface
Index

Introducing vue-router


For a single-page application, when a user switches from one page (logic page) to another, the application will need to update the URL in the address bar accordingly so that when the user refreshes the page or copies the URL and shares it with others to open, the application will always render the same page. In Vue applications, we can achieve this by using vue-router (https://router.vuejs.org/guide), which is already included in the frontend scaffold that we generated.

In this section, we will only cover the features of vue-router that we need at the moment. For those features that we don't talk about here, we will introduce them later in this book.

As you probably have noticed, in App.vue there is <router-view> inside the #app div. vue-router will render the component that matches the router configuration in front-end/src/router, which is used by the root Vue component in front-end/src/main.js. When we open a page and there is no match component found on that...