Nuxt pages as routes
The convention-over-configuration approach was popularized by Ruby on Rails. It is an opinionated approach to web development that sets up some things in a framework in a set-and-forget manner. When we say that it is opinionated, it simply means that out of several possibilities to approach an issue, the developers of the framework chose one specific way of doing things, and that approach is the only way that something is done.
We can say that Nuxt.js is opinionated because it follows the convention of pages as routes. Thus, instead of us having to manually set up routes in our apps—that is, rather than having to configure them—the framework follows a simple convention. Inside the pages folder, the index.vue
file acts as the root route: /
. This means that if we run our app, visiting the root route at localhost:3000
is equal to visiting localhost:3000/index.vue
.
Similarly, if we create a file called about.vue
and place it inside the pages folder, to view this file we'd...