fallbackRoute property

set fallbackRoute (Route route)

Sets a fallback route to use if no other registered Route matches a request.

If not set, default behavior is to return "404 Not Found".

Note that if a Route is matched, but the handler returns 404, then the fallback route is not called. To rewrite 404s you should use middleware.

Implementation

set fallbackRoute(Route route) =>
    _app.fallback = _ReportExceptionMiddleware(this)(
      _SessionMiddleware(
        serverpod.server,
      )(route.asHandler),
    );