Backbone.js: trailing slash in the end of url route

Asked By: Anonymous

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!


Solution

Answered By: Anonymous

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

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

techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno