Skip to content

Commit

Permalink
htmx guide: Note the usual things to remember when adding controller
Browse files Browse the repository at this point in the history
slightly more fool-proof documentation
  • Loading branch information
unhammer committed Jun 22, 2024
1 parent d9ca29f commit 419efdb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Guide/htmx-and-hyperscript.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ data CounterController
deriving (Eq, Show, Data)
```

Add `parseRoute @CounterController` to the list of `instance FrontController WebApplication` in `FrontController.hs` (or you'll get a 404 on calling it), and add an `instance AutoRoute CounterController` to `Routes.hs` (or you'll get a compilation error about it not being an instance of AutoRoute).

Instead of using the `render` function, htmx routes are better used with `respondHtml` to avoid the layout being shipped as part of the response. The same function can be used for initializing the view as well as upating.

```haskell
Expand Down

0 comments on commit 419efdb

Please sign in to comment.