The middleware property is used to specify middleware for a page. The assigned middleware will always be executed before the page is rendered, as follows:
// pages/secured.vue
export default {
middleware: 'auth'
}
In this example, auth is the filename of the middleware that you will create in the /middleware/ directory, as follows:
// middleware/auth.js
export default function ({ route }) {
//...
}
We will cover middleware in depth in Chapter 11, Writing Route Middlewares and Server Middlewares.
So, that's it. You have completed the sections on the Nuxt view, from the app template, HTML head, and layouts to pages. Well done! We will cover the Vue components in the next chapter. But right now, the next thing we should look at is creating custom transitions between pages in Nuxt because transitions and pages are closely related, just like the page transition property you have been briefly introduced to. So, let's move on to our final topic of this...