How to get a backup route to search for unknown pages in backbone.js

I have a set of routes configured as follows:

routes: {
  '!/home': 'home',
  '!/home/:page': 'home'
}

I am wondering how to set up a route so that if a user requests an unknown page, I can easily redirect to a 404.html static page?

+5
source share
1 answer

In your router (for example, the first two routes):

routes: {
  "path/": "objectList",
  "path/:id": "objectItem",
  ":whatever": "notFound"
}

The latter is the most general route, and it takes away everything that is not recognized by more specific routes.

+10
source

All Articles