#axum #htmx #routing #typed #handler

axum-routing-htmx

Typed routing macros for HTMX on axum

4 releases (2 breaking)

0.3.0 Oct 17, 2024
0.2.0 Sep 29, 2024
0.1.1 Sep 28, 2024
0.1.0 Sep 28, 2024

#1554 in Web programming


Used in axum-routing-htmx-macros

MIT/Apache

15KB
99 lines

axum-routing-htmx

Type-safe routes in axum tailored for HTMX. Forked from axum-typed-routing.

This is in very early development. Expect breaking changes.


lib.rs:

Basic usage

The following example demonstrates the basic usage of the library. On top of any regular handler, you can add the route macro to create a typed route. Any path- or query-parameters in the url will be type-checked at compile-time, and properly extracted into the handler.

Some valid url's as get-methods are:

  • /item/1?amount=2&offset=3
  • /item/1?amount=2
  • /item/1?offset=3
  • /item/500

Dependencies

~6–12MB
~136K SLoC