lightrouter icon indicating copy to clipboard operation
lightrouter copied to clipboard

Unmatch path state?

Open royhg opened this issue 8 years ago • 2 comments

Dear Gary,

How to add routes with unmatch path state? So I can redirect to 404 page?

Tq. Roy

royhg avatar Mar 01 '17 08:03 royhg

Routes are matched in order, so first matching one is executed first and then stops. Therefore you can add a route at the very end which always matches, like...

router.add('.*', my404Handler);

garygreen avatar Mar 01 '17 09:03 garygreen

.run() also returns a route that was matched, so you could use that to determine how to proceed in your app.

garygreen avatar Mar 01 '17 10:03 garygreen