Mithril.js: Can't use a "404" not found route

Created on 16 Dec 2015  路  2Comments  路  Source: MithrilJS/mithril.js

Hello,

I tried to configure a "not found" catch all route like:

m.route.mode = 'hash';
m.route(document.body, '/not-found', {
  '/': components.pages.Login,
  '/not-found': components.pages.NotFound,
  [...]
});

It works fine when I type anything as the URL. But when I load up the page without any hash (http://domain.com/), it redirects to /not-found on the first page load.

Any ways to simulate a not found page?

Thank you

Most helpful comment

Use a variadic route to catch 404:

m.route(document.body, '/', {
    '/': home,
    '/:any...' : notFound
})

All 2 comments

Use a variadic route to catch 404:

m.route(document.body, '/', {
    '/': home,
    '/:any...' : notFound
})

Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

isiahmeadows picture isiahmeadows  路  4Comments

mke21 picture mke21  路  3Comments

omenking picture omenking  路  3Comments

millken picture millken  路  4Comments

tivac picture tivac  路  3Comments