BLACK FRIDAY - Get 35% off your Mastering Nuxt license!

Anonymous Middleware

In this example:

pages/anonymous-middleware.vue contains a middleware function which uses the store to call the increment mutation with results from the store displayed on the page.

store/analytics.js sets the pageVisits to 0 and increments the visits every time the increment function is called.

Learn more in the Directory Structure book in the middleware chapter.

Loading CodeSandbox...