Eleandro Duzentos
Eleandro Duzentos

Reputation: 1568

How to disable Nuxt.js automatic file based route generation in favor of a manually generated routes.js file?

As we may know, Nuxt.js generates its routes by default based on the file structure of the pages folder.

What I want to know is, how to use a file and put my routes by myself, manually, instead of have Nuxt.js generating them for me?

Why?

I want more control of my routes, more explicit code and less files on the project.

I think its more easy to setup route params defining them explicit into a routes.js file rather then setting them by adding files into the project.

Any idea of how to do that, like on a normal Vue App? Thanks.

Upvotes: 9

Views: 5303

Answers (1)

Aldarund
Aldarund

Reputation: 17621

You can use @nuxtjs/router for that https://www.npmjs.com/package/@nuxtjs/router

Another option is to enchance automatic routing with https://github.com/nuxt-community/router-extras-module

Upvotes: 6

Related Questions