Home

Issue: 808

Question: how to make route parameter required?

[issue link]

Hi!

I want to create a route like this:
path: "/article/:slug"

Where the slug is required. My directory structure is:

/pages
---/article
------/_slug.vue

and the nuxt generates:
path: "/article/:slug?"

For every situation like this I create a workaround with index.vue inside pages/article with content:

<script>
  export default {
    fetch ({error}) {
      error({statusCode: 404})
    }
  }
</script>

Could I do this easier without creating error index?

And how about a path like this?
/search/:page/:query

Thanks!

This question is available on Nuxt.js community (#c694)