22

I have url routes in my app Router.js:

'items': 'items',
'items/drafts': 'itemsDrafts',
'items/drafts/new': 'itemsDraftsNew',
...

But in browser when I define items/drafts/new/ it gives me 404 error :(

Is there a way to make this urls the same without copy-pasting all routes and adding trailing to them like:

'items': 'items',
'items/drafts': 'itemsDrafts',
'items/drafts/new': 'itemsDraftsNew',
'items/': 'items',
'items/drafts/': 'itemsDrafts',
'items/drafts/new/': 'itemsDraftsNew',
...

?

Thanks!

Kosmetika
  • 20,774
  • 37
  • 108
  • 172

1 Answers1

44

my solution: 'url(/)': 'urlFunc'

() - means optional (also take a look here - https://stackoverflow.com/a/14329976/2117550)

Community
  • 1
  • 1
Kosmetika
  • 20,774
  • 37
  • 108
  • 172