Inline-Middleware

A middleware can be also be created without an external file.

You can insert it as a function in the middleware array of the page:

definePageMeta({
  middleware: [
    function (to, from) {
      // your middleware code
    }
  ]
})

Middlewares will be executed in the same order that they appear in the array.