Skip to content

Commit

Permalink
Document Program.withNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmil committed Nov 1, 2023
1 parent 85bf973 commit 8a177b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Website/docs/Routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ Here are the steps to set up an inferred router:
|> Program.withRouter router
```

You can specify the endpoint to show when the user visits a URL that can't be parsed with `Program.withNotFound`.
Note that this endpoint is used when initially loading a page with an unrecognized URL; however it is not used when the user clicks a link in the Bolero page to an unrecognized URL, as that would prevent using external links.

```fsharp
Program.mkSimple initModel update view
|> Program.withRouter router
|> Program.withNotFound Home
```

> Note: the message `PageChanged` is dispatched automatically when the URL has been modified (eg by clicking a link).
> It is not recommended to dispatch it directly yourself, as it will result in the same message being dispatched twice: first by you, and then by the router.
>
Expand Down

0 comments on commit 8a177b9

Please sign in to comment.