Configure Named Routes in Vue.js and Nuxt.js

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet
Published 8 years ago
Updated 5 years ago

As you create more and more routes, the paths become difficult to manage and concatenate the parts together as just a giant string. Using named routes allows you to reference the route by a simple string then pass in the params as an object. This lesson covers configuring named routes in Nuxt.js in the nuxt.config.js and the passing the named route to a router-link.

[00:00] With routes, it's often way more convenient to have a named route, instead of worrying about the path, and then mapping to the path in a router link like this. The way you set up a name for your route is pretty self explanatory. You give it a property of name. Going to name this "user". Now, I have a named route.

[00:17] In my index, instead of putting together a URL to navigate to, I can delete all of this, and instead evaluate an object that has a name. I'm telling it to grab my "user" route based on that name. It has params, and this is another object with an ID of

[00:42] Now, this has become much more flexible if you need to move things around inside of your params, or if you're changing around URLs and you just want to keep the names intact inside of your router links, because now, everything just works the exact same, so refresh.

[00:57] Click on Palpatine, and we still have Palpatine, and all the other users work, as well.

~ 11 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today