hannoeru / vite-plugin-pages

File system based route generator for ⚡️Vite
MIT License
1.84k stars 127 forks source link

Question: How to implement/use middleware feature like in nuxt.js ? #356

Closed sriks82 closed 1 year ago

sriks82 commented 1 year ago

Is it possible to create src/middleware/guest.js, src/middleware/auth.js, src/middleware.role.js... and define the middleware in pages ?

For example, is a page exists like: src/pages/student/somepage.vue then this page should be accessible only by an authenticated user and the role of the user should be student.

olcchi commented 1 year ago

I had the same idea, but the answer I got so far is no , But there are corresponding methods to achieve the same function, such as extendRoute