Home / Blog / News / Enhanced Routing with UnPlugin Vue Router
Enhanced Routing with UnPlugin Vue Router

Enhanced Routing with UnPlugin Vue Router

Daniel Kelly
Daniel Kelly
Updated: May 7th 2024

Are you ready to take enhance your experience with Vue Router? Look no further than our latest course Enhanced Routing with UnPlugin Vue Router.

During the course, we cover how to do everything you already know with vanilla Vue Router but in a type-safe manner and with file-based routing.

Essentially, go from registering all routes in a js or ts file IN ADDITION to creating the page components in your file system like this….

// Just an example of what registering a bunch of routes manually looks like
// don't worry about reading the whole thing, it's overwhelming...
// and you used to have to write it all!
const routes = [
  {
    path: "/about",
    children: [
      {
        path: "",
        name: "/about/",
        // this file created elsewhere ?
        component: () => import("@/views/About.vue"), 
      },
      {
        path: "me",
        name: "/about/me",
        // this file created elsewhere ?
        component: () => import("@/views/AboutMe.vue"),
      },
    ],
  },
  {
    path: "/users",
    name: "/users",
    // etc?
    component: () => import("@/views/Users"),
    children: [
      {
        path: "",
        name: "/users/",
        component: () => import("@/views/UsersIndex"),
      },
      {
        path: ":id",
        name: "/users/[id]",
        component: () => import("@/views/UsersShow"),
      },
      {
        path: "create",
        name: "/users/create",
        component: () => import("@/views/UsersCreate"),
      },
    ],
  },
  {
    path: "/users/not-nested",
    name: "/users.not-nested",
    component: () => import("@/views/RandomUnnested.vue"),
  },
  {
    path: "/:path(.*)",
    name: "catchall",
    component: () => import("@/views/404.vue"),
  },
];

to auto generating your routes based on the file structure and filenames of a pages directory. The following directory structure produces the same routes as the manually registered ones above.

Screenshot of file structure with file-based routing.

PLUS! Get autocomplete and error detection of your route names, params and more with TypeScript

Screenshot of route paths in autocomplete list of values for the RouterLink to prop

What to Expect from this Course

In the course you’ll learn how to benefit from these 2 amazing features while learning the file-based syntax for:

  • Nested routes
  • Dynamice routes (route params)
  • Repeatable route params
  • Optional route params
  • catch all routes
  • route guards, meta, alias and more with definePage
  • and more!

Dive into 13 short, succinct, and on point lessons now. Get up and running with unplugin-vue-router in less than 30 minutes.

Start learning Vue.js for free

Daniel Kelly
Daniel Kelly
Daniel is the lead instructor at Vue School and enjoys helping other developers reach their full potential. He has 10+ years of developer experience using technologies including Vue.js, Nuxt.js, and Laravel.

Comments

Latest Vue School Articles

Vue.js – 2025 In Review and a Peek into 2026

Vue.js – 2025 In Review and a Peek into 2026

A 2025 overview of the Vue ecosystem — from Vue 3.6 performance upgrades to Nuxt 4, Pinia 3, Vite’s new tooling, and adoption trends. Learn what’s new, what’s stable, and what’s coming to Vue.js in 2026.
Daniel Kelly
Daniel Kelly
VueSchool Black Friday

VueSchool Black Friday

Black Friday is the perfect moment to elevate your front-end skills or upgrade your dev toolkit without stretching the budget. We’ve gathered a few limited-time deals on tools, courses, and resources that can help accelerate your growth as a developer at a fraction of the usual cost.
Mostafa Said
Mostafa Said
VueSchool logo

Our goal is to be the number one source of Vue.js knowledge for all skill levels. We offer the knowledge of our industry leaders through awesome video courses for a ridiculously low price.

More than 200.000 users have already joined us. You are welcome too!

Follow us on Social

© All rights reserved. Made with ❤️ by BitterBrains, Inc.