fallback method

void fallback(
  1. Handler handler
)

Answers requests no route matched, instead of the default 404.

Read from the outermost router, as axum does for a top-level fallback. Unknown paths inside a nested prefix keep the default 404 instead of reaching an outer fallback such as a single-page app.

Implementation

void fallback(Handler handler) {
  _requireOpen();
  internals.fallback = handler;
}