Complete Vue.js 2 Web Development_ Practical guide to building end-to-end web development solutions with Vue.js 2

(singke) #1
Using Vue-Router Dynamic Routes to Load Data Chapter 9

*: PageNotFound – this will catch any unspecified routes


With our routes and components decided upon, we can begin to create our app.


Create initial files


With the app outlined in the preceding section, we can create the skeletons for our file
structure and components. With this app being a large-scale app, we are going to split our


files into individual files for each component. This means our files are much more
manageable and our main app JavaScript file does not grow out of control.


Although acceptable for development, deploying an app with this number of files could


potentially increase your load times depending on how your server is set up. With the
traditional HTTP/1.1, browsers have to request and load each file – which is a hindrance if


there are multiple files. However, with HTTP/2, you are able to push several files to the
user at the same time – in which case, multiple files can somewhat improve the


performance of your app.


Whichever method you choose to use with your deployment, it is highly advised you


minify your JavaScript when deploying the code to a production environment. This ensures


your code is as small as possible when being served up to your user:

Free download pdf